editor: fix crash on removing task list

This commit is contained in:
Abdullah Atta
2024-03-19 12:29:37 +05:00
parent ff6b65c55c
commit 479dec6998

View File

@@ -39,7 +39,7 @@ export function TaskListComponent(
const checked = stats.total > 0 && stats.total === stats.checked;
const isNested = useMemo(() => {
if (!pos) return false;
if (!pos || editor.state.doc.nodeSize < pos) return false;
return editor.state.doc.resolve(pos).parent.type.name === TaskItem.name;
}, [editor.state.doc, pos]);