@@ -114,40 +114,41 @@ export const KeyboardShortcutsExtension = Extension.create<{
114114 const selectionEmpty = state . selection . empty ;
115115 const blockAtDocStart = blockInfo . blockContainer . beforePos === 1 ;
116116
117- const prevBlockPos = getPrevBlockPos (
118- state . doc ,
119- state . doc . resolve ( blockInfo . blockContainer . beforePos )
120- ) ;
121- const prevBlockInfo = getBlockInfoFromResolvedPos (
122- state . doc . resolve ( prevBlockPos . pos )
123- ) ;
124-
125- const prevBlockNotTableAndNoContent =
126- prevBlockInfo . blockContent . node . type . spec . content === "" ||
127- ( prevBlockInfo . blockContent . node . type . spec . content ===
128- "inline*" &&
129- prevBlockInfo . blockContent . node . childCount === 0 ) ;
130-
131117 if (
132118 ! blockAtDocStart &&
133119 selectionAtBlockStart &&
134120 selectionEmpty &&
135- depth === 1 &&
136- prevBlockNotTableAndNoContent
121+ depth === 1
137122 ) {
138- return chain ( )
139- . cut (
140- {
141- from : blockInfo . blockContainer . beforePos ,
142- to : blockInfo . blockContainer . afterPos ,
143- } ,
144- prevBlockInfo . blockContainer . afterPos
145- )
146- . deleteRange ( {
147- from : prevBlockInfo . blockContainer . beforePos ,
148- to : prevBlockInfo . blockContainer . afterPos ,
149- } )
150- . run ( ) ;
123+ const prevBlockPos = getPrevBlockPos (
124+ state . doc ,
125+ state . doc . resolve ( blockInfo . blockContainer . beforePos )
126+ ) ;
127+ const prevBlockInfo = getBlockInfoFromResolvedPos (
128+ state . doc . resolve ( prevBlockPos . pos )
129+ ) ;
130+
131+ const prevBlockNotTableAndNoContent =
132+ prevBlockInfo . blockContent . node . type . spec . content === "" ||
133+ ( prevBlockInfo . blockContent . node . type . spec . content ===
134+ "inline*" &&
135+ prevBlockInfo . blockContent . node . childCount === 0 ) ;
136+
137+ if ( prevBlockNotTableAndNoContent ) {
138+ return chain ( )
139+ . cut (
140+ {
141+ from : blockInfo . blockContainer . beforePos ,
142+ to : blockInfo . blockContainer . afterPos ,
143+ } ,
144+ prevBlockInfo . blockContainer . afterPos
145+ )
146+ . deleteRange ( {
147+ from : prevBlockInfo . blockContainer . beforePos ,
148+ to : prevBlockInfo . blockContainer . afterPos ,
149+ } )
150+ . run ( ) ;
151+ }
151152 }
152153
153154 return false ;
0 commit comments