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
2020import ts from 'typescript'
2121import { watchEffect } from 'vue'
2222import { isDark } from '../logic/dark'
23+ import { shortcutsEnabled } from '../state'
2324
2425window . MonacoEnvironment = {
2526 getWorker ( _ , label ) {
@@ -97,6 +98,18 @@ const setup = createSingletonPromise(async () => {
9798 Object . assign ( editorOptions , result ?. editorOptions )
9899 }
99100
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+
100113 // Use Shiki to highlight Monaco
101114 shikiToMonaco ( highlighter , monaco )
102115 if ( typeof themes === 'string' ) {
You can’t perform that action at this time.
0 commit comments