提交 1af9eab6 编写于 作者: M Matt Bierner

Make sure we restore IgnoreMenuShortcuts on re-focus

Fixes #67879
上级 7e459ec0
......@@ -140,6 +140,9 @@ class SvgBlocker extends Disposable {
}
class WebviewKeyboardHandler extends Disposable {
private _ignoreMenuShortcut = false;
constructor(
private readonly _webview: Electron.WebviewTag
) {
......@@ -150,8 +153,9 @@ class WebviewKeyboardHandler extends Disposable {
const contents = this.getWebContents();
if (contents) {
contents.on('before-input-event', (_event, input) => {
if (input.type === 'keyDown') {
this.setIgnoreMenuShortcuts(input.control || input.meta);
if (input.type === 'keyDown' && document.activeElement === this._webview) {
this._ignoreMenuShortcut = input.control || input.meta;
this.setIgnoreMenuShortcuts(this._ignoreMenuShortcut);
}
});
}
......@@ -167,6 +171,10 @@ class WebviewKeyboardHandler extends Disposable {
this.handleKeydown(event.args[0]);
return;
case 'did-focus':
this.setIgnoreMenuShortcuts(this._ignoreMenuShortcut);
break;
case 'did-blur':
this.setIgnoreMenuShortcuts(false);
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册