@@ -144,21 +144,20 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
144144 const cursor = draggingBlock . workspace . getCursor ( ) as LineCursor ;
145145 if ( ! cursor ) return null ;
146146
147+ // Helper function for traversal.
148+ function isConnection ( node : ASTNode | null ) : boolean {
149+ return ! ! node && node . isConnection ( ) ;
150+ }
151+
147152 const connectionChecker = draggingBlock . workspace . connectionChecker ;
148153 let candidateConnection : ConnectionCandidate | null = null ;
149154 let potential : ASTNode | null = this . searchNode ;
150155 const dir = this . currentDragDirection ;
151156 while ( potential && ! candidateConnection ) {
152157 if ( dir === Direction . Up || dir === Direction . Left ) {
153- potential = cursor . getPreviousNode ( potential , ( node ) => {
154- // @ts -expect-error isConnectionType is private.
155- return node && ASTNode . isConnectionType ( node . getType ( ) ) ;
156- } ) ;
158+ potential = cursor . getPreviousNode ( potential , isConnection , true ) ;
157159 } else if ( dir === Direction . Down || dir === Direction . Right ) {
158- potential = cursor . getNextNode ( potential , ( node ) => {
159- // @ts -expect-error isConnectionType is private.
160- return node && ASTNode . isConnectionType ( node . getType ( ) ) ;
161- } ) ;
160+ potential = cursor . getNextNode ( potential , isConnection , true ) ;
162161 }
163162
164163 localConns . forEach ( ( conn : RenderedConnection ) => {
0 commit comments