This commit is contained in:
Kirill
2026-05-27 18:34:45 +05:00
parent b392884503
commit 8f3bd7aa3b
@@ -18,9 +18,14 @@ export function RichTextMessageContent({ value, tone = 'default' }: RichTextMess
}) })
useEffect(() => { useEffect(() => {
if (!editor) return if (!editor || editor.isDestroyed) return
const normalizedValue = value.trim() ? value : '<p></p>' const normalizedValue = value.trim() ? value : '<p></p>'
if (editor.getHTML() === normalizedValue) return try {
if (editor.getHTML() === normalizedValue) return
} catch {
// editor schema not ready yet
return
}
editor.commands.setContent(normalizedValue, { emitUpdate: false }) editor.commands.setContent(normalizedValue, { emitUpdate: false })
}, [editor, value]) }, [editor, value])