File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
packages/core/src/extensions/KeyboardShortcuts Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -434,7 +434,7 @@ export const KeyboardShortcutsExtension = Extension.create<{
434
434
] ) ;
435
435
436
436
const handleEnter = ( withShift = false ) => {
437
- return this . editor . commands . first ( ( { commands } ) => [
437
+ return this . editor . commands . first ( ( { commands, tr } ) => [
438
438
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
439
439
// of the block.
440
440
( ) =>
@@ -486,9 +486,21 @@ export const KeyboardShortcutsExtension = Extension.create<{
486
486
// both enter and shift+enter.
487
487
blockHardBreakShortcut === "enter"
488
488
) {
489
- return commands . insertContent ( {
490
- type : "hardBreak" ,
491
- } ) ;
489
+ const marks =
490
+ tr . storedMarks ||
491
+ tr . selection . $head
492
+ . marks ( )
493
+ . filter ( ( m ) =>
494
+ this . editor . extensionManager . splittableMarks . includes (
495
+ m . type . name ,
496
+ ) ,
497
+ ) ;
498
+
499
+ tr . insert (
500
+ tr . selection . head ,
501
+ tr . doc . type . schema . nodes . hardBreak . create ( ) ,
502
+ ) . ensureMarks ( marks ) ;
503
+ return true ;
492
504
}
493
505
494
506
return false ;
You can’t perform that action at this time.
0 commit comments