From b97bebe021e6e587770cb99f94b18ee6d96c1630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Mon, 7 Jun 2021 23:55:18 +0200 Subject: [PATCH] fix: fix a bug when insert newline at node start, fix #1411 --- packages/core/src/commands/splitBlock.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/commands/splitBlock.ts b/packages/core/src/commands/splitBlock.ts index 4096a2dd..ffca4c74 100644 --- a/packages/core/src/commands/splitBlock.ts +++ b/packages/core/src/commands/splitBlock.ts @@ -118,7 +118,7 @@ export const splitBlock: RawCommands['splitBlock'] = ({ keepMarks = true } = {}) const first = tr.mapping.map($from.before()) 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) } }