fix: fix a bug when insert newline at node start, fix #1411

This commit is contained in:
Philipp Kühn
2021-06-07 23:55:18 +02:00
parent cc696091c9
commit b97bebe021

View File

@@ -118,7 +118,7 @@ export const splitBlock: RawCommands['splitBlock'] = ({ keepMarks = true } = {})
const first = tr.mapping.map($from.before()) const first = tr.mapping.map($from.before())
const $first = tr.doc.resolve(first) const $first = tr.doc.resolve(first)
if ($from.parent.canReplaceWith($first.index(), $first.index() + 1, deflt)) { if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) {
tr.setNodeMarkup(tr.mapping.map($from.before()), deflt) tr.setNodeMarkup(tr.mapping.map($from.before()), deflt)
} }
} }