提交 48cc02be 编写于 作者: M Matt Bierner

Extract setIgnoreMenuShortcuts

上级 3cdcfa85
......@@ -157,7 +157,7 @@ class WebviewKeyboardHandler extends Disposable {
const contents = this.getWebContents();
if (contents) {
contents.on('before-input-event', (_event, input) => {
contents.setIgnoreMenuShortcuts(input.control || input.meta);
this.setIgnoreMenuShortcuts(input.control || input.meta);
});
}
}));
......@@ -173,12 +173,7 @@ class WebviewKeyboardHandler extends Disposable {
return;
case 'did-blur':
if (this.shouldToggleMenuShortcutsEnablement) {
const contents = this.getWebContents();
if (contents) {
contents.setIgnoreMenuShortcuts(false);
}
}
this.setIgnoreMenuShortcuts(false);
return;
}
}));
......@@ -188,6 +183,16 @@ class WebviewKeyboardHandler extends Disposable {
return isMacintosh;
}
private setIgnoreMenuShortcuts(value: boolean) {
if (!this.shouldToggleMenuShortcutsEnablement) {
return;
}
const contents = this.getWebContents();
if (contents) {
contents.setIgnoreMenuShortcuts(value);
}
}
private getWebContents(): Electron.WebContents | undefined {
const contents = this._webview.getWebContents();
if (contents && !contents.isDestroyed()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册