@@ -318,29 +318,27 @@ const stopEvent = (event: Event) => {
318
318
event . stopImmediatePropagation ( )
319
319
return false
320
320
}
321
- function bindStandardBindings ( ) : Record < LineMode , KeyBinding [ ] > {
322
- const autoOrMultiHandlers = handlerToKeyBinding (
323
- textEditorsMultilineBindings . handler ( {
324
- newline : ( e ) => {
325
- e . stopImmediatePropagation ( )
326
- return insertNewlineKeepIndent ( e . codemirrorView )
327
- } ,
328
- } ) ,
329
- )
330
- return {
331
- single : [ ] ,
332
- multi : [ autoOrMultiHandlers , ... verticalMovementKeymap ( ) ] ,
333
- auto : [ autoOrMultiHandlers ] ,
334
- }
321
+
322
+ const autoOrMultiHandlers = handlerToKeyBinding (
323
+ textEditorsMultilineBindings . handler ( {
324
+ newline : ( e ) => {
325
+ e . stopImmediatePropagation ( )
326
+ return insertNewlineKeepIndent ( e . codemirrorView )
327
+ } ,
328
+ } ) ,
329
+ )
330
+
331
+ const standardBindings : Record < LineMode , KeyBinding [ ] > = {
332
+ single : [ ] ,
333
+ multi : [ autoOrMultiHandlers , ... verticalMovementKeymap ( ) ] ,
334
+ auto : [ autoOrMultiHandlers ] ,
335
335
}
336
336
337
- function keyBindings ( lineMode : LineMode | undefined ) : Extension {
338
- const mode = lineMode ?? 'multi'
339
- const standardBindings = bindStandardBindings ( )
337
+ function keyBindings ( lineMode : LineMode ) : Extension {
340
338
return [
341
339
Prec . lowest ( keymap . of ( baseKeymap ( ) ) ) ,
342
- Prec . low ( keymap . of ( standardBindings [ mode ] ) ) ,
343
- ...( mode === 'multi' ? [ EditorView . domEventHandlers ( { wheel : stopEvent } ) ] : [ ] ) ,
340
+ Prec . low ( keymap . of ( standardBindings [ lineMode ] ) ) ,
341
+ ...( lineMode === 'multi' ? [ EditorView . domEventHandlers ( { wheel : stopEvent } ) ] : [ ] ) ,
344
342
]
345
343
}
346
344
0 commit comments