diff --git a/src/lib/components/common/RichTextInput.svelte b/src/lib/components/common/RichTextInput.svelte index c9c8101c3..57fbf567b 100644 --- a/src/lib/components/common/RichTextInput.svelte +++ b/src/lib/components/common/RichTextInput.svelte @@ -191,15 +191,19 @@ onTransaction: () => { // force re-render so `editor.isActive` works as expected editor = editor; - const newValue = turndownService + let newValue = turndownService .turndown( - (preserveBreaks - ? editor.getHTML().replace(/

<\/p>/g, '
') - : editor.getHTML() - ).replace(/ {2,}/g, (m) => m.replace(/ /g, '\u00a0')) + editor + .getHTML() + .replace(/

<\/p>/g, '
') + .replace(/ {2,}/g, (m) => m.replace(/ /g, '\u00a0')) ) .replace(/\u00a0/g, ' '); + if (!preserveBreaks) { + newValue = newValue.replace(//g, ''); + } + if (value !== newValue) { value = newValue;