File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed 
packages/editor-codemirror/src/behaviors Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1313 * 
1414 */ 
1515
16- import  {  indentWithTab  }  from  "@codemirror/commands" ; 
16+ import  {  indentLess ,   indentMore  }  from  "@codemirror/commands" ; 
1717
1818import  {  indentOnInput  }  from  "@codemirror/language" ; 
1919import  {  keymap  }  from  "@codemirror/view" ; 
2020
2121import  {  Behavior  }  from  "." ; 
22+ import  {  acceptCompletion ,  completionStatus  }  from  "@codemirror/autocomplete" ; 
2223
23- export  function  indentBehavior ( )   : Behavior  { 
24+ export  function  tabBehavior ( ) : Behavior  { 
2425  return  { 
2526    extensions : [ 
2627      indentOnInput ( ) , 
27-       keymap . of ( [ indentWithTab ] ) 
28+       keymap . of ( [ 
29+         { 
30+           key : 'Tab' , 
31+           preventDefault : true , 
32+           shift : indentLess , 
33+           run : e  =>  { 
34+             if  ( ! completionStatus ( e . state ) )  return  indentMore ( e ) ; 
35+             return  acceptCompletion ( e ) ; 
36+           } , 
37+         } , 
38+       ] ) 
2839    ] 
29-   } 
40+   } ; 
3041} 
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { CodeViewOptions, ExtensionContext } from "editor";
2727import  {  langModeBehavior  }  from  './langmode' ; 
2828import  {  keyboardBehavior  }  from  './keyboard' ; 
2929import  {  findBehavior  }  from  './find' ; 
30- import  {  indentBehavior  }  from  './indent' ; 
30+ import  {  tabBehavior  }  from  './indent' ; 
3131import  {  trackSelectionBehavior  }  from  './trackselection' ; 
3232import  {  themeBehavior  }  from  './theme' ; 
3333import  {  prefsBehavior  }  from  './prefs' ; 
@@ -63,7 +63,7 @@ export function createBehaviors(context: BehaviorContext): Behavior[] {
6363    langModeBehavior ( context ) , 
6464    completionBehavior ( context ) , 
6565    findBehavior ( context ) , 
66-     indentBehavior ( ) , 
66+     tabBehavior ( ) , 
6767    themeBehavior ( context ) , 
6868    prefsBehavior ( context ) , 
6969    trackSelectionBehavior ( context ) , 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments