web: fix crash on launch

This commit is contained in:
Ammar Ahmed
2026-08-25 12:18:21 +05:00
parent fee2285795
commit 5074ee65d2

View File

@@ -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
});
},