fix: menu should allow focused BaseWindow
where possible (#43404)
fix: menu should allow focused BaseWindow
This commit is contained in:
parent
7391db93e2
commit
50ce448556
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