Call role method on focused web contents
This commit is contained in:
parent
06e595e7cc
commit
f9a8bd3ea5
3 changed files with 10 additions and 16 deletions
|
@ -115,7 +115,7 @@ exports.getDefaultAccelerator = (role) => {
|
|||
if (roles.hasOwnProperty(role)) return roles[role].accelerator
|
||||
}
|
||||
|
||||
exports.execute = (role, focusedWindow) => {
|
||||
exports.execute = (role, focusedWindow, focusedWebContents) => {
|
||||
if (!roles.hasOwnProperty(role)) return false
|
||||
if (process.platform === 'darwin') return false
|
||||
|
||||
|
@ -135,15 +135,8 @@ exports.execute = (role, focusedWindow) => {
|
|||
return true
|
||||
}
|
||||
|
||||
if (webContentsMethod && focusedWindow != null) {
|
||||
const {webContents} = focusedWindow
|
||||
if (webContents) {
|
||||
if (webContents.isDevToolsFocused()) {
|
||||
webContents.devToolsWebContents[webContentsMethod]()
|
||||
} else {
|
||||
webContents[webContentsMethod]()
|
||||
}
|
||||
}
|
||||
if (webContentsMethod && focusedWebContents != null) {
|
||||
focusedWebContents[webContentsMethod]()
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue