Skip to content

Commit 4ba74b6

Browse files
Made Enter preserve block type when at start of block (#370)
1 parent 6229dcf commit 4ba74b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/core/src/extensions/Blocks/nodes/BlockContainer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,12 +552,14 @@ export const BlockContainer = Node.create<{
552552
state.selection.from
553553
)!;
554554

555+
const selectionAtBlockStart =
556+
state.selection.$anchor.parentOffset === 0;
555557
const blockEmpty = node.textContent.length === 0;
556558

557559
if (!blockEmpty) {
558560
chain()
559561
.deleteSelection()
560-
.BNSplitBlock(state.selection.from, false)
562+
.BNSplitBlock(state.selection.from, selectionAtBlockStart)
561563
.run();
562564

563565
return true;

0 commit comments

Comments
 (0)