File tree Expand file tree Collapse file tree
packages/core/src/extensions/tiptap-extensions/KeyboardShortcuts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -184,6 +184,7 @@ export const KeyboardShortcutsExtension = Extension.create<{
184184
185185 let chainedCommands = chain ( ) ;
186186
187+ // Moves the children of the current block to the previous one.
187188 if ( blockInfo . childContainer ) {
188189 chainedCommands . insertContentAt (
189190 blockInfo . bnBlock . afterPos ,
@@ -437,6 +438,8 @@ export const KeyboardShortcutsExtension = Extension.create<{
437438 const newBlockContentPos = newBlockInsertionPos + 2 ;
438439
439440 if ( dispatch ) {
441+ // Creates a new block with the children of the current block,
442+ // if it has any.
440443 const newBlock = state . schema . nodes [
441444 "blockContainer"
442445 ] . createAndFill (
@@ -448,12 +451,15 @@ export const KeyboardShortcutsExtension = Extension.create<{
448451 ] . filter ( ( node ) => node !== undefined ) ,
449452 ) ! ;
450453
454+ // Inserts the new block and moves the selection to it.
451455 tr . insert ( newBlockInsertionPos , newBlock )
452456 . setSelection (
453457 new TextSelection ( tr . doc . resolve ( newBlockContentPos ) ) ,
454458 )
455459 . scrollIntoView ( ) ;
456460
461+ // Deletes old block's children, as they have been moved to
462+ // the new one.
457463 if ( blockInfo . childContainer ) {
458464 tr . delete (
459465 blockInfo . childContainer . beforePos ,
You can’t perform that action at this time.
0 commit comments