From 5074ee65d26f437a707e5e3299f97d39ce84a553 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Tue, 25 Aug 2026 12:18:21 +0500 Subject: [PATCH] web: fix crash on launch --- apps/web/src/components/editor/tiptap.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsx index d32f6807e..670e1ea9c 100644 --- a/apps/web/src/components/editor/tiptap.tsx +++ b/apps/web/src/components/editor/tiptap.tsx @@ -312,7 +312,7 @@ function TipTap(props: TipTapProps) { selected: 0 } }, - tableOfContents: getTableOfContents(editor.view.dom) + tableOfContents: getTableOfContents(editor.state.doc, editor.view.dom) }); }, onUpdate: ({ editor, transaction }) => { @@ -322,7 +322,10 @@ function TipTap(props: TipTapProps) { }); if (changedHeadings.length > 0) { useEditorManager.getState().updateEditor(id, { - tableOfContents: getTableOfContents(editor.view.dom) + tableOfContents: getTableOfContents( + editor.state.doc, + editor.view.dom + ) }); } @@ -350,7 +353,7 @@ function TipTap(props: TipTapProps) { canRedo: editor.can().redo(), canUndo: editor.can().undo(), tableOfContents: transaction.getMeta("isUpdatingContent") - ? getTableOfContents(editor.view.dom) + ? getTableOfContents(editor.state.doc, editor.view.dom) : useEditorManager.getState().getEditor(id)?.tableOfContents }); },