From ce7cc37077a6938d24d7741b8e939f01d2d60551 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 12 Jul 2025 18:15:35 +0400 Subject: [PATCH] refac --- src/lib/components/common/RichTextInput.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/components/common/RichTextInput.svelte b/src/lib/components/common/RichTextInput.svelte index 2187475dbf..148a1a3611 100644 --- a/src/lib/components/common/RichTextInput.svelte +++ b/src/lib/components/common/RichTextInput.svelte @@ -215,7 +215,9 @@ if (state.length === 2 && state[0] === 0 && state[1] === 0) { // Empty state, check if we have content to initialize - if (content) { + // check if editor empty as well + const isEmptyEditor = !editor || editor.getText().trim() === ''; + if (content && isEmptyEditor) { const pydoc = prosemirrorJSONToYDoc(editor.schema, content); if (pydoc) { Y.applyUpdate(this.doc, Y.encodeStateAsUpdate(pydoc));