mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
editor: fix position out of range error
This commit is contained in:
@@ -39,7 +39,9 @@ export function TaskListComponent(
|
||||
const checked = stats.total > 0 && stats.total === stats.checked;
|
||||
|
||||
const isNested = useMemo(() => {
|
||||
if (!pos || editor.state.doc.nodeSize < pos) return false;
|
||||
if (!pos || !(pos >= 0 && pos <= editor.state.doc.content.size))
|
||||
return false;
|
||||
|
||||
return editor.state.doc.resolve(pos).parent.type.name === TaskItem.name;
|
||||
}, [editor.state.doc, pos]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user