Skip to content

Commit 061fd35

Browse files
committed
Fix bug in splitBlock
FIX: Fix a regression where `splitBlock` could crash when splitting at the end of a non-default block. Closes ProseMirror/prosemirror#1179
1 parent f75bd6e commit 061fd35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export function splitBlock(state, dispatch) {
320320
tr.split(tr.mapping.map($from.pos), 1, types)
321321
if (!atEnd && !$from.parentOffset && $from.parent.type != deflt) {
322322
let first = tr.mapping.map($from.before()), $first = tr.doc.resolve(first)
323-
if ($from.parent.canReplaceWith($first.index(), $first.index() + 1, deflt))
323+
if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt))
324324
tr.setNodeMarkup(tr.mapping.map($from.before()), deflt)
325325
}
326326
}

0 commit comments

Comments
 (0)