Closed git-net closed 4 years ago
What version of .Net Core are you using? Do you get this error when you run the sample code in this GitHub repo?
Thank You
I tested this in both .Net Core 3.1 and .Net Core 5.0 and I can't reproduce this error. Can I see the code that sets HtmlContent . From what I can tell this just should not be needed. Thanks!
netcore 3.1. e,my english is poor. i means i resolved "Cannot read property 'root' of undefined." by add HtmlContent ,
before my.razor
....
<BlazoredTextEditor.... @ref="textEditor" />
....
protected override async Task OnAfterRenderAsync(bool firstrender) {
.....
await textEditor.LoadHTMLContent(....) // throw
}
after: add HtmlContent and remove textEditor.LoadHTMLContent(....)
<BlazoredTextEditor.... @ref="textEditor" HtmlContent="sssss" />
when i debug in browser i found 'loadQuillHTMLContent called before createQuill' sometimes。
If you are trying to load HTML content when the page first loads use:
<EditorContent>
@((MarkupString)@QuillReadOnlyContent)
</EditorContent>
See: https://github.com/Blazored/TextEditor/blob/main/samples/BlazorServerSide/Pages/Index.razor
Only use:
await this.QuillHtml.LoadHTMLContent(QuillContent);
On an event like a button click.
Thanks!!
i found sometimes QuillFunctions.loadQuillHTMLContent called before createQuill,then throw error Cannot read property 'root' of undefined. i try add parameter @ BlazoredTextEditor.razor
[Parameter] public string HtmlContent { get; set; }
and change OnAfterRenderAsync @ BlazoredTextEditor.razor
@ myComp.razor
its works fine。