From e13e5edc8e98963db3c2e17483f5e45de2a8df3b Mon Sep 17 00:00:00 2001 From: ayakabot Date: Mon, 4 May 2026 20:50:39 +0800 Subject: [PATCH] fix(issues): trimEnd comparison on blur to avoid unnecessary updates (#2054) Fixed: #2053 --- packages/views/editor/content-editor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/views/editor/content-editor.tsx b/packages/views/editor/content-editor.tsx index 32c1982abd..1457c64b88 100644 --- a/packages/views/editor/content-editor.tsx +++ b/packages/views/editor/content-editor.tsx @@ -157,7 +157,7 @@ const ContentEditor = forwardRef( // Explicit for clarity — the real perf win is useEditorState in BubbleMenu. shouldRerenderOnTransaction: false, onCreate: ({ editor: ed }) => { - lastEmittedRef.current = stripBlobUrls(ed.getMarkdown()); + lastEmittedRef.current = stripBlobUrls(ed.getMarkdown()).trimEnd(); }, content: defaultValue ? preprocessMarkdown(defaultValue) : "", contentType: defaultValue ? "markdown" : undefined, @@ -173,7 +173,7 @@ const ContentEditor = forwardRef( if (!onUpdateRef.current) return; if (debounceRef.current) clearTimeout(debounceRef.current); debounceRef.current = setTimeout(() => { - const md = stripBlobUrls(ed.getMarkdown()); + const md = stripBlobUrls(ed.getMarkdown()).trimEnd(); if (md === lastEmittedRef.current) return; lastEmittedRef.current = md; onUpdateRef.current?.(md);