File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/comm
20
20
import ts from 'typescript'
21
21
import { watchEffect } from 'vue'
22
22
import { isDark } from '../logic/dark'
23
+ import { shortcutsEnabled } from '../state'
23
24
24
25
window . MonacoEnvironment = {
25
26
getWorker ( _ , label ) {
@@ -97,6 +98,18 @@ const setup = createSingletonPromise(async () => {
97
98
Object . assign ( editorOptions , result ?. editorOptions )
98
99
}
99
100
101
+ // Disable shortcuts when focusing Monaco editor.
102
+ monaco . editor . onDidCreateEditor ( ( editor ) => {
103
+ let areShortcutsEnabled = shortcutsEnabled . value
104
+ editor . onDidFocusEditorWidget ( ( ) => {
105
+ areShortcutsEnabled = shortcutsEnabled . value
106
+ shortcutsEnabled . value = false
107
+ } )
108
+ editor . onDidBlurEditorWidget ( ( ) => {
109
+ shortcutsEnabled . value = areShortcutsEnabled
110
+ } )
111
+ } )
112
+
100
113
// Use Shiki to highlight Monaco
101
114
shikiToMonaco ( highlighter , monaco )
102
115
if ( typeof themes === 'string' ) {
You can’t perform that action at this time.
0 commit comments