Phenomenon
In April 2025, a regression was identified in prosemirror-commands (fixed in v1. 6.2). When the splitBlock command was executed at the very end of a block that had a sibling in its parent, the logic for finding the split depth could miscalculate the document size, leading to a fatal RangeError. This effectively rendered the editor unusable for complex structured documents.
Reproduction Steps
- Use
prosemirror-commandsbetween 1.6.0 and 1.6.1. - Create a document with a block (e.g., a paragraph) inside another block (e.g., a blockquote), followed by a sibling node.
- Position the caret at the end of the inner paragraph.
- Trigger the
splitBlockcommand (e.g., press Enter).
Observed Behavior
- Crash: The browser console reports
RangeError: Position out of rangefrom within the ProseMirror library. - View Freeze: The DOM is not updated, and further input may be blocked.
Expected Behavior
The inner block should be split into two, maintaining the parent’s structure.
References & Solutions
Mitigation: Upgrade Commands Package
This was a library-level logic error. The fix involved correcting the range calculation when splitting near document boundaries.
# Fix by upgrading to the latest version
npm update prosemirror-commands