executeCommand: (event, commandId) => {
const command = this.commandsMap[commandId]
if (command == null) return
-
command.click(event, BrowserWindow.getFocusedWindow(), webContents.getFocusedWebContents())
},
menuWillShow: () => {
let focused = null
for (let contents of getAllWebContents()) {
if (!contents.isFocused()) continue
-
+ if (focused == null) focused = contents
// Return webview web contents which may be embedded inside another
// web contents that is also reporting as focused
if (contents.getType() === 'webview') return contents
-
- if (focused == null) focused = contents
}
return focused
}