Π·Π΅ΡΠΊΠ°Π»ΠΎ ΠΈΠ· https://github.com/electron/electron.git
π add isDevToolsFocused to WebContents to fix #3928, add devtools-[focused|open|close] events to WebView to fix #3783.
This commit is contained in:
Π ΠΎΠ΄ΠΈΡΠ΅Π»Ρ
8aced2c31e
ΠΠΎΠΌΠΌΠΈΡ
96d68b9285
|
@ -780,6 +780,13 @@ bool WebContents::IsDevToolsOpened() {
|
|||
return managed_web_contents()->IsDevToolsViewShowing();
|
||||
}
|
||||
|
||||
bool WebContents::IsDevToolsFocused() {
|
||||
if (type_ == REMOTE)
|
||||
return false;
|
||||
|
||||
return managed_web_contents()->GetView()->IsDevToolsViewFocused();
|
||||
}
|
||||
|
||||
void WebContents::EnableDeviceEmulation(
|
||||
const blink::WebDeviceEmulationParams& params) {
|
||||
if (type_ == REMOTE)
|
||||
|
@ -1080,6 +1087,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("openDevTools", &WebContents::OpenDevTools)
|
||||
.SetMethod("closeDevTools", &WebContents::CloseDevTools)
|
||||
.SetMethod("isDevToolsOpened", &WebContents::IsDevToolsOpened)
|
||||
.SetMethod("isDevToolsFocused", &WebContents::IsDevToolsFocused)
|
||||
.SetMethod("enableDeviceEmulation",
|
||||
&WebContents::EnableDeviceEmulation)
|
||||
.SetMethod("disableDeviceEmulation",
|
||||
|
|
|
@ -79,6 +79,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
void OpenDevTools(mate::Arguments* args);
|
||||
void CloseDevTools();
|
||||
bool IsDevToolsOpened();
|
||||
bool IsDevToolsFocused();
|
||||
void ToggleDevTools();
|
||||
void EnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
|
||||
void DisableDeviceEmulation();
|
||||
|
|
|
@ -83,6 +83,7 @@ BrowserWindow::send = -> @webContents.send.apply @webContents, arguments
|
|||
BrowserWindow::openDevTools = -> @webContents.openDevTools.apply @webContents, arguments
|
||||
BrowserWindow::closeDevTools = -> @webContents.closeDevTools()
|
||||
BrowserWindow::isDevToolsOpened = -> @webContents.isDevToolsOpened()
|
||||
BrowserWindow::isDevToolsFocused = -> @webContents.isDevToolsFocused()
|
||||
BrowserWindow::toggleDevTools = -> @webContents.toggleDevTools()
|
||||
BrowserWindow::inspectElement = -> @webContents.inspectElement.apply @webContents, arguments
|
||||
BrowserWindow::inspectServiceWorker = -> @webContents.inspectServiceWorker()
|
||||
|
|
|
@ -13,6 +13,9 @@ supportedWebViewEvents = [
|
|||
'did-get-redirect-request'
|
||||
'dom-ready'
|
||||
'console-message'
|
||||
'devtools-opened'
|
||||
'devtools-closed'
|
||||
'devtools-focused'
|
||||
'new-window'
|
||||
'close'
|
||||
'crashed'
|
||||
|
|
|
@ -15,6 +15,9 @@ WEB_VIEW_EVENTS =
|
|||
'did-get-redirect-request': ['oldURL', 'newURL', 'isMainFrame']
|
||||
'dom-ready': []
|
||||
'console-message': ['level', 'message', 'line', 'sourceId']
|
||||
'devtools-opened': []
|
||||
'devtools-closed': []
|
||||
'devtools-focused': []
|
||||
'new-window': ['url', 'frameName', 'disposition', 'options']
|
||||
'close': []
|
||||
'crashed': []
|
||||
|
|
ΠΠ°Π³ΡΡΠ·ΠΊΠ°β¦
Π‘ΡΡΠ»ΠΊΠ° Π² Π½ΠΎΠ²ΠΎΠΉ Π·Π°Π΄Π°ΡΠ΅