菜单快捷键如何设置,目前重载窗口的菜单框架内有设置快捷键,但是不生效 #1757
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
请问 我这里 2.20 测试是生效了的,不过因为 OpenSumi 内部(ide-electron-basic)已经注册了keybinding,想替换的话要先取消注册。 这个 Module 的位置: import { ElectronBasicModule } from '@opensumi/ide-electron-basic/lib/browser'; import {
Domain,
KeybindingContribution,
KeybindingRegistry,
} from '@opensumi/ide-core-browser';
import {
MenuContribution,
IMenuRegistry,
} from '@opensumi/ide-core-browser/lib/menu/next';
const COMMAND_ID = 'electron.reload';
@Domain(MenuContribution, KeybindingContribution)
export class MenubarContribution
implements MenuContribution, KeybindingContribution
{
registerMenus(registry: IMenuRegistry) {
registry.registerMenuItem('windowMenuBar', {
command: {
id: COMMAND_ID,
label: 'Reload Window',
},
order: 2,
group: '2_views',
});
}
registerKeybindings(registry: KeybindingRegistry) {
registry.unregisterKeybinding({
command: 'electron.reload',
keybinding: 'shift+ctrlcmd+r',
});
registry.registerKeybinding({
command: COMMAND_ID,
keybinding: 'shift+ctrlcmd+d',
});
}
} |
Beta Was this translation helpful? Give feedback.
-
注意应用侧的 Module 需要在 这个 bydesign 的逻辑,贡献点必须声明了才会生效。 因为模块是通过 @Domain 这个装饰器来声明自己有哪些 Contribution,然后框架内有函数来获取哪些模块是有 KeybindingContribution 的,再执行这些模块。 |
Beta Was this translation helpful? Give feedback.
-
有关贡献点机制可以先读一下我们的官方文档:https://opensumi.com/zh/docs/develop/basic-design/contribution-point |
Beta Was this translation helpful? Give feedback.
有关贡献点机制可以先读一下我们的官方文档:https://opensumi.com/zh/docs/develop/basic-design/contribution-point