fix: resolve TipTap v3 type errors in RichEditor

- Cast editor.storage to any for tiptap-markdown's getMarkdown (untyped extension storage)
- Replace setContent(value, false) with setContent(value, { emitUpdate: false }) for TipTap v3 API

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ahp
2026-10-18 10:18:51 +03:30
co-authored by Claude Sonnet 4.6
parent 03610bc3d3
commit b4a7e7e1d3
+5 -3
View File
@@ -28,7 +28,8 @@ export function RichEditor({ value, onChange, placeholder, className }: Props) {
content: value, content: value,
immediatelyRender: false, immediatelyRender: false,
onUpdate({ editor: e }) { onUpdate({ editor: e }) {
const md = e.storage.markdown?.getMarkdown?.() ?? e.getText(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
const md = (e.storage as any).markdown?.getMarkdown?.() ?? e.getText();
onChange(md); onChange(md);
}, },
}); });
@@ -36,9 +37,10 @@ export function RichEditor({ value, onChange, placeholder, className }: Props) {
// Sync external value changes (e.g. when a new lesson is loaded). // Sync external value changes (e.g. when a new lesson is loaded).
useEffect(() => { useEffect(() => {
if (!editor) return; if (!editor) return;
const current = editor.storage.markdown?.getMarkdown?.() ?? editor.getText(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
const current = (editor.storage as any).markdown?.getMarkdown?.() ?? editor.getText();
if (current !== value) { if (current !== value) {
editor.commands.setContent(value, false); editor.commands.setContent(value, { emitUpdate: false });
} }
}, [value, editor]); }, [value, editor]);