fix: emit focus/blur events for webview (#14344)
* fix: emit focus/blur events for webview * test: webview can emit focus event
This commit is contained in:
parent
edd5c4b9bb
commit
459a2304b4
5 changed files with 53 additions and 21 deletions
|
@ -26,6 +26,7 @@ const supportedWebViewEvents = [
|
|||
'did-navigate',
|
||||
'did-frame-navigate',
|
||||
'did-navigate-in-page',
|
||||
'focus-change',
|
||||
'close',
|
||||
'crashed',
|
||||
'gpu-crashed',
|
||||
|
@ -322,6 +323,10 @@ ipcMain.on('ELECTRON_GUEST_VIEW_MANAGER_ATTACH_GUEST', function (event, embedder
|
|||
attachGuest(event, embedderFrameId, elementInstanceId, guestInstanceId, params)
|
||||
})
|
||||
|
||||
ipcMain.on('ELECTRON_GUEST_VIEW_MANAGER_FOCUS_CHANGE', function (event, focus, guestInstanceId) {
|
||||
event.sender.emit('focus-change', {}, focus, guestInstanceId)
|
||||
})
|
||||
|
||||
// Returns WebContents from its guest id.
|
||||
const getGuest = function (guestInstanceId) {
|
||||
const guestInstance = guestInstances[guestInstanceId]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue