diff --git a/packages/core-browser/src/common/common.contribution.ts b/packages/core-browser/src/common/common.contribution.ts index 28f8429f9c..14d504be7d 100644 --- a/packages/core-browser/src/common/common.contribution.ts +++ b/packages/core-browser/src/common/common.contribution.ts @@ -60,8 +60,8 @@ export class ClientCommonContribution constructor() { const overridePropertiesDefault = { - 'application.supportsOpenFolder': !!this.appConfig.isElectronRenderer && !this.appConfig.isRemote, - 'application.supportsOpenWorkspace': !!this.appConfig.isElectronRenderer && !this.appConfig.isRemote, + 'application.supportsOpenFolder': !this.appConfig.isRemote, + 'application.supportsOpenWorkspace': !this.appConfig.isRemote, 'debug.toolbar.top': this.appConfig.isElectronRenderer ? 0 : this.layoutViewSize.menubarHeight, }; const keys = Object.keys(this.schema.properties); diff --git a/packages/core-browser/src/keybinding/keybinding.ts b/packages/core-browser/src/keybinding/keybinding.ts index 6a3f055b80..a4ece42a40 100644 --- a/packages/core-browser/src/keybinding/keybinding.ts +++ b/packages/core-browser/src/keybinding/keybinding.ts @@ -17,6 +17,7 @@ import { ContextKeyExpression } from '@opensumi/monaco-editor-core/esm/vs/platfo import { IContextKeyService } from '../context-key'; import { KeyboardLayoutService } from '../keyboard/keyboard-layout-service'; import { Key, KeyCode, KeySequence, SpecialCases } from '../keyboard/keys'; +import { AppConfig } from '../react-providers/config-provider'; import { IStatusBarService, StatusBarAlignment } from '../services'; export enum KeybindingScope { @@ -230,6 +231,9 @@ export class KeybindingRegistryImpl implements KeybindingRegistry, KeybindingSer @Autowired(IStatusBarService) protected readonly statusBar: IStatusBarService; + @Autowired(AppConfig) + private readonly appConfig: AppConfig; + public async initialize(): Promise { await this.keyboardLayoutService.initialize(); this.keyboardLayoutService.onKeyboardLayoutChanged(() => { @@ -883,6 +887,10 @@ export class KeybindingRegistryImpl implements KeybindingRegistry, KeybindingSer return false; } for (const binding of bindings) { + // 在web下electron绑定的浏览器基础快捷键无法使用,这里跳过,直接使用浏览器的快捷键 + if (!this.appConfig.isElectronRenderer && binding.command.startsWith('electron.')) { + continue; + } if (this.isEnabled(binding, event)) { if (this.isPseudoCommand(binding.command)) { // 让事件冒泡