Case ce-0576-prosemirror-splitblock-crash · Scenario scenario-paragraph-behavior

ProseMirror: splitBlock crashes on specific node nesting

OS: Windows 11 Device: Desktop Any Browser: All Browsers n/a Keyboard: US QWERTY Status: confirmed
prosemirror commands splitblock crash regression

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

  1. Use prosemirror-commands between 1.6.0 and 1.6.1.
  2. Create a document with a block (e.g., a paragraph) inside another block (e.g., a blockquote), followed by a sibling node.
  3. Position the caret at the end of the inner paragraph.
  4. Trigger the splitBlock command (e.g., press Enter).

Observed Behavior

  • Crash: The browser console reports RangeError: Position out of range from 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
Step 1: Complex Document Structure

Text|

Sibling

An editor with nested blocks and siblings.
Step 2: Execute splitBlock
User presses Enter, triggering the splitBlock command.
vs
✅ Expected

Text

|

Sibling

Expected: The block is split into two paragraphs within the same parent block.

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: Windows 11
Device: Desktop Any
Browser: All Browsers n/a
Keyboard: US QWERTY
Your environment
Sample HTML:
Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.

Comments & Discussion

Have questions, suggestions, or want to share your experience? Join the discussion below.