fix https://github.com/oqtane/oqtane.blogs/issues/44 - rich text editor throwing exception in specific scenario
This commit is contained in:
@ -63,8 +63,7 @@
|
|||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div @ref="@_editorElement">
|
<div @ref="@_editorElement"></div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
@ -104,6 +103,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
private bool _initialized = false;
|
||||||
private ElementReference _editorElement;
|
private ElementReference _editorElement;
|
||||||
private ElementReference _toolBar;
|
private ElementReference _toolBar;
|
||||||
private bool _richfilemanager = false;
|
private bool _richfilemanager = false;
|
||||||
@ -178,17 +178,22 @@
|
|||||||
DebugLevel);
|
DebugLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_richfilemanager)
|
if (_initialized)
|
||||||
{
|
{
|
||||||
await interop.LoadEditorContent(_editorElement, _richhtml);
|
if (!_richfilemanager) // do not override the content when the file manager is displayed
|
||||||
}
|
{
|
||||||
|
await interop.LoadEditorContent(_editorElement, _richhtml);
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(_originalrichhtml))
|
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 as it may have changed)
|
||||||
_originalrichhtml = await interop.GetHtml(_editorElement);
|
_originalrichhtml = await interop.GetHtml(_editorElement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_initialized = true; // ensures that the rich text editor is created before trying to access its methods
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseRichFileManager()
|
public void CloseRichFileManager()
|
||||||
|
Reference in New Issue
Block a user