docs/solutions/logic-errors/2026-05-09-slate-v2-full-block-delete-fast-path-must-stop-at-selection-boundaries.md
The model-owned full-block delete fast path assumed that a selection from the start of one block to the start of another block meant "remove the first block." That is only true when the focus is at the immediate next sibling.
huge-document-cut expected block 2502 to shift into index 2500.2501, proving only one block was
removed.2502 and 2501.Return all fully selected sibling block paths, then remove them in reverse path order:
if (
!Path.isSibling(blockPath, endBlockPath) ||
!Path.isBefore(blockPath, endBlockPath)
) {
return null
}
const paths: Path[] = []
let path = blockPath
while (!Path.equals(path, endBlockPath)) {
paths.push(path)
path = Path.next(path)
}
editor.update((tx) => {
for (const blockPath of [...blockPaths].reverse()) {
tx.nodes.remove({ at: blockPath })
}
})
A start-to-start selection is exclusive of the focus block. For a selection from
block N start to block N + 2 start, the fully selected sibling blocks are
N and N + 1, not just N, and not text inside N.
Reverse removal preserves path correctness while deleting multiple siblings.