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
|
@ -24,6 +24,7 @@ const WEB_VIEW_EVENTS = {
|
|||
'did-navigate': ['url', 'httpResponseCode', 'httpStatusText'],
|
||||
'did-frame-navigate': ['url', 'httpResponseCode', 'httpStatusText', 'isMainFrame', 'frameProcessId', 'frameRoutingId'],
|
||||
'did-navigate-in-page': ['url', 'isMainFrame', 'frameProcessId', 'frameRoutingId'],
|
||||
'focus-change': ['focus', 'guestInstanceId'],
|
||||
'close': [],
|
||||
'crashed': [],
|
||||
'gpu-crashed': [],
|
||||
|
@ -55,6 +56,8 @@ const dispatchEvent = function (webView, eventName, eventKey, ...args) {
|
|||
webView.dispatchEvent(domEvent)
|
||||
if (eventName === 'load-commit') {
|
||||
webView.onLoadCommit(domEvent)
|
||||
} else if (eventName === 'focus-change') {
|
||||
webView.onFocusChange(domEvent)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue