Merge pull request #3641 from sbwalker/dev
fix issue where rich text was not being refreshed in the editor when content changed, and original rich text was not always preserved
This commit is contained in:
commit
e44b31d755
|
@ -162,27 +162,31 @@
|
||||||
_richhtml = Content;
|
_richhtml = Content;
|
||||||
_rawhtml = Content;
|
_rawhtml = Content;
|
||||||
_originalrawhtml = _rawhtml; // preserve for comparison later
|
_originalrawhtml = _rawhtml; // preserve for comparison later
|
||||||
|
_originalrichhtml = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
await base.OnAfterRenderAsync(firstRender);
|
await base.OnAfterRenderAsync(firstRender);
|
||||||
|
|
||||||
var interop = new RichTextEditorInterop(JSRuntime);
|
if (AllowRichText)
|
||||||
|
|
||||||
if (firstRender)
|
|
||||||
{
|
{
|
||||||
await interop.CreateEditor(
|
var interop = new RichTextEditorInterop(JSRuntime);
|
||||||
_editorElement,
|
|
||||||
_toolBar,
|
if (firstRender)
|
||||||
ReadOnly,
|
{
|
||||||
Placeholder,
|
await interop.CreateEditor(
|
||||||
Theme,
|
_editorElement,
|
||||||
DebugLevel);
|
_toolBar,
|
||||||
|
ReadOnly,
|
||||||
|
Placeholder,
|
||||||
|
Theme,
|
||||||
|
DebugLevel);
|
||||||
|
}
|
||||||
|
|
||||||
await interop.LoadEditorContent(_editorElement, _richhtml);
|
await interop.LoadEditorContent(_editorElement, _richhtml);
|
||||||
|
|
||||||
if (AllowRichText)
|
if (string.IsNullOrEmpty(_originalrichhtml))
|
||||||
{
|
{
|
||||||
// preserve a copy of the rich text content (Quill sanitizes content so we need to retrieve it from the editor)
|
// preserve a copy of the rich text content (Quill sanitizes content so we need to retrieve it from the editor)
|
||||||
_originalrichhtml = await interop.GetHtml(_editorElement);
|
_originalrichhtml = await interop.GetHtml(_editorElement);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user