refactor: remove menu-will-close / setTimeout workaround (#18582)
This commit is contained in:
parent
3c8acf3687
commit
cf628d9287
1 changed files with 1 additions and 8 deletions
|
@ -69,14 +69,7 @@ ipcMainUtils.handle('ELECTRON_INSPECTOR_CONTEXT_MENU', function (event, items, i
|
||||||
const menu = Menu.buildFromTemplate(template)
|
const menu = Menu.buildFromTemplate(template)
|
||||||
const window = event.sender.getOwnerBrowserWindow()
|
const window = event.sender.getOwnerBrowserWindow()
|
||||||
|
|
||||||
menu.once('menu-will-close', () => {
|
menu.popup({ window, callback: () => resolve() })
|
||||||
// menu-will-close is emitted before the click handler, but needs to be sent after.
|
|
||||||
// otherwise, DevToolsAPI.contextMenuCleared() would be called before
|
|
||||||
// DevToolsAPI.contextMenuItemSelected(id) and the menu will not work properly.
|
|
||||||
setTimeout(() => resolve())
|
|
||||||
})
|
|
||||||
|
|
||||||
menu.popup({ window })
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue