fix: Handline for top-level node in getCurrentBlock (#12022)

This commit is contained in:
Tom Moor authored and GitHub committed 2026-04-13 18:11:41 -04:00
1 parent d9b54c63c0
commit e61de60475
1 file changed
+3 -6
+3 -6
View File
@@ -12,13 +12,10 @@ export function getCurrentBlock(
const { $head } = state.selection;
// Walk up the tree to find the first block node
for (let d = $head.depth; d >= 0; d--) {
for (let d = $head.depth; d > 0; d--) {
const node = $head.node(d);
const pos = $head.before(d);
if (node.isBlock && d > 0) {
// Don't return the document itself
return [node, pos];
if (node.isBlock) {
return [node, $head.before(d)];
}
}