Fix #1837 RichTextEditor Content not re-Rendering

Change to the OnAfterRenderAsync method and changed OnInitialized to OnParametersSet
This commit is contained in:
Leigh
2021-12-03 06:31:45 +01:00
parent 9664ff67f3
commit 65d468be33

View File

@ -120,19 +120,19 @@
new Resource { ResourceType = ResourceType.Script, Bundle = "Quill", Url = "js/quill-interop.js" }
};
protected override void OnInitialized()
protected override void OnParametersSet()
{
_content = Content; // raw HTML
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
var interop = new RichTextEditorInterop(JSRuntime);
if (firstRender)
{
await base.OnAfterRenderAsync(firstRender);
var interop = new RichTextEditorInterop(JSRuntime);
await interop.CreateEditor(
_editorElement,
_toolBar,
@ -140,6 +140,7 @@
Placeholder,
Theme,
DebugLevel);
}
await interop.LoadEditorContent(_editorElement, Content);
@ -147,7 +148,7 @@
// preserve a copy of the rich text content ( Quill sanitizes content so we need to retrieve it from the editor )
_original = await interop.GetHtml(_editorElement);
}
}
public void CloseFileManager()