mirror of
https://github.com/outline/outline.git
synced 2026-11-22 22:02:35 +03:00
fix: Handline for top-level node in getCurrentBlock (#12022)
This commit is contained in:
1 parent
d9b54c63c0
commit
e61de60475
1 file changed
+3
-6
@@ -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)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user