Blazorise
Blazorise copied to clipboard
"Empty" RichTextEdit
Describe the bug After setting HTML of RichTextEdit, the edit area still remains empty - most of the times. Blazorise Version is 1.0.4 and 1.0.6
To Reproduce I tracked it down to this simple example
@using Blazorise.RichTextEdit
<RichTextEdit @ref="editor"
Theme="RichTextEditTheme.Snow">
</RichTextEdit>
@code {
private RichTextEdit? editor;
private string html = "Hello world.";
private bool isSet;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!isSet && editor != null)
{
isSet = true;
await editor.SetHtmlAsync(html);
StateHasChanged();
}
await base.OnAfterRenderAsync(firstRender);
}
}
The only thing this code does is to call SetHtmlAsync
on startup.
After opening the page, "Hello world" should be visible.
Expected behavior
The text is changed after SetHtmlAsync
Additional context
In my tests it worked far way more often (if not always), if I
a) remove StateHasChanged();
in OnAfterRenderAsync
, or
b) remove Theme="RichTextEditTheme.Snow"
both of which are inexplainable to me (especially b)
since Snow
is the default value)