-
需求:强制弹框进行表单数据填写。 调用IDialogService中的open方法并传入参数: 弹框后按回车键,弹框就关闭了,好像是执行了取消按钮事件,这个回车快捷键事件应该如何禁用或者重写? 代码如下: // ...
@Autowired(IDialogService)
dialogService: IDialogService
// ...
await this.dialogService.open(<Demo />, MessageType.Empty, [], false, undefined, {keyboard: false}) |
Beta Was this translation helpful? Give feedback.
Answered by
erha19
Feb 27, 2023
Replies: 2 comments
-
一种参考的方案:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
@naduohua 这部分快捷键的注册逻辑在 https://github.com/opensumi/core/blob/f3fd01381d6ee854102d491b14957e9e634941a3/packages/overlay/src/browser/dialog.contribution.ts#L37~L41 你可以通过注册一个 registerKeybindings(bindings: KeybindingRegistry) {
bindings.unregisterKeybinding({
command: DIALOG_COMMANDS.ENSURE.id,
keybinding: 'enter',
when: `${DialogViewVisibleContext.raw}`,
});
} 或 @Autowired(KeybindingRegistry)
protected keybindingRegistry: KeybindingRegistry;
this.keybindingRegistry.unregisterKeybinding({
command: DIALOG_COMMANDS.ENSURE.id,
keybinding: 'enter',
when: `${DialogViewVisibleContext.raw}`,
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lovelytan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@naduohua 这部分快捷键的注册逻辑在 https://github.com/opensumi/core/blob/f3fd01381d6ee854102d491b14957e9e634941a3/packages/overlay/src/browser/dialog.contribution.ts#L37~L41
你可以通过注册一个
KeybindingContribution
去卸载这个快捷键的注册:或