fix: menu should allow focused BaseWindow
where possible (#43439)
fix: menu should allow focused BaseWindow Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
557d5c901a
commit
a373ab027b
5 changed files with 25 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
|||
import { BaseWindow, MenuItem, webContents, Menu as MenuType, BrowserWindow, MenuItemConstructorOptions } from 'electron/main';
|
||||
import { BaseWindow, MenuItem, webContents, Menu as MenuType, MenuItemConstructorOptions } from 'electron/main';
|
||||
import { sortMenuItems } from '@electron/internal/browser/api/menu-utils';
|
||||
import { setApplicationMenuWasSet } from '@electron/internal/browser/default-menu';
|
||||
|
||||
|
@ -54,7 +54,7 @@ Menu.prototype._executeCommand = function (event, id) {
|
|||
const command = this.commandsMap[id];
|
||||
if (!command) return;
|
||||
const focusedWindow = BaseWindow.getFocusedWindow();
|
||||
command.click(event, focusedWindow instanceof BrowserWindow ? focusedWindow : undefined, webContents.getFocusedWebContents());
|
||||
command.click(event, focusedWindow, webContents.getFocusedWebContents());
|
||||
};
|
||||
|
||||
Menu.prototype._menuWillShow = function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue