mirror of
https://github.com/multica-ai/multica.git
synced 2026-08-03 11:10:23 +02:00
fix(issues): trimEnd comparison on blur to avoid unnecessary updates (#2054)
Fixed: #2053
This commit is contained in:
@@ -157,7 +157,7 @@ const ContentEditor = forwardRef<ContentEditorRef, ContentEditorProps>(
|
||||
// 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<ContentEditorRef, ContentEditorProps>(
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user