convert Quill's empty content to empty string

This commit is contained in:
sbwalker 2024-04-12 15:10:47 -04:00
parent 39dff1ea7c
commit bc978a91e3

View File

@ -188,7 +188,7 @@
// 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) // 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; _initialized = true;
} }
else else
@ -239,7 +239,7 @@
else else
{ {
var richhtml = ""; var richhtml = "";
if (AllowRichText) if (AllowRichText)
{ {
var interop = new RichTextEditorInterop(JSRuntime); var interop = new RichTextEditorInterop(JSRuntime);
@ -248,6 +248,11 @@
if (richhtml != _originalrichhtml && !string.IsNullOrEmpty(richhtml)) if (richhtml != _originalrichhtml && !string.IsNullOrEmpty(richhtml))
{ {
// convert Quill's empty content to empty string
if (richhtml == "<p><br></p>")
{
richhtml = string.Empty;
}
return richhtml; return richhtml;
} }
else else