From b1c196ed8387020a6d034c072604c2493d169ae9 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 1 Oct 2025 12:39:49 -0500 Subject: [PATCH] fix: non rich text handling --- src/lib/components/common/RichTextInput.svelte | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lib/components/common/RichTextInput.svelte b/src/lib/components/common/RichTextInput.svelte index a97b53741b..0586b4a4f1 100644 --- a/src/lib/components/common/RichTextInput.svelte +++ b/src/lib/components/common/RichTextInput.svelte @@ -789,11 +789,19 @@ ) .replace(/\u00a0/g, ' '); - onChange({ - html: htmlValue, - json: jsonValue, - md: mdValue - }); + if (richText) { + onChange({ + html: htmlValue, + json: jsonValue, + md: mdValue + }); + } else { + // Plain text path: preserve \t and \n exactly + const doc = editor.view.state.doc; + const plain = doc.textBetween(0, doc.content.size, '\n\n', '\n'); // keeps \t intact + value = plain; + onChange({ html: null, json: null, md: plain }); + } if (json) { value = jsonValue;