@@ -825,6 +825,24 @@ export const indentLess: StateCommand = ({state, dispatch}) => {
825
825
return true
826
826
}
827
827
828
+ /// Enables or disables
829
+ /// [tab-focus mode](#view.EditorView.setTabFocusMode). While on, this
830
+ /// prevents the editor's key bindings from capturing Tab or
831
+ /// Shift-Tab, making it possible for the user to move focus out of
832
+ /// the editor with the keyboard.
833
+ export const toggleTabFocusMode : Command = view => {
834
+ view . setTabFocusMode ( )
835
+ return true
836
+ }
837
+
838
+ /// Temporarily enables [tab-focus
839
+ /// mode](#view.EditorView.setTabFocusMode) for two seconds or until
840
+ /// another key is pressed.
841
+ export const temporarilySetTabFocusMode : Command = view => {
842
+ view . setTabFocusMode ( 2000 )
843
+ return true
844
+ }
845
+
828
846
/// Insert a tab character at the cursor or, if something is selected,
829
847
/// use [`indentMore`](#commands.indentMore) to indent the entire
830
848
/// selection.
@@ -961,6 +979,7 @@ export const standardKeymap: readonly KeyBinding[] = ([
961
979
/// - Shift-Ctrl-\\ (Shift-Cmd-\\ on macOS): [`cursorMatchingBracket`](#commands.cursorMatchingBracket)
962
980
/// - Ctrl-/ (Cmd-/ on macOS): [`toggleComment`](#commands.toggleComment).
963
981
/// - Shift-Alt-a: [`toggleBlockComment`](#commands.toggleBlockComment).
982
+ /// - Ctrl-m (Alt-Shift-m on macOS): [`toggleTabFocusMode`](#commands.toggleTabFocusMode).
964
983
export const defaultKeymap : readonly KeyBinding [ ] = ( [
965
984
{ key : "Alt-ArrowLeft" , mac : "Ctrl-ArrowLeft" , run : cursorSyntaxLeft , shift : selectSyntaxLeft } ,
966
985
{ key : "Alt-ArrowRight" , mac : "Ctrl-ArrowRight" , run : cursorSyntaxRight , shift : selectSyntaxRight } ,
@@ -986,7 +1005,9 @@ export const defaultKeymap: readonly KeyBinding[] = ([
986
1005
{ key : "Shift-Mod-\\" , run : cursorMatchingBracket } ,
987
1006
988
1007
{ key : "Mod-/" , run : toggleComment } ,
989
- { key : "Alt-A" , run : toggleBlockComment }
1008
+ { key : "Alt-A" , run : toggleBlockComment } ,
1009
+
1010
+ { key : "Ctrl-m" , mac : "Shift-Alt-m" , run : toggleTabFocusMode } ,
990
1011
] as readonly KeyBinding [ ] ) . concat ( standardKeymap )
991
1012
992
1013
/// A binding that binds Tab to [`indentMore`](#commands.indentMore) and
0 commit comments