devtools: allow opening in specified dock state
This commit is contained in:
parent
0bf1e56156
commit
58dfad4d01
2 changed files with 12 additions and 5 deletions
|
@ -848,14 +848,20 @@ void WebContents::OpenDevTools(mate::Arguments* args) {
|
||||||
if (type_ == REMOTE)
|
if (type_ == REMOTE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool detach = false;
|
std::string state;
|
||||||
if (type_ == WEB_VIEW) {
|
if (type_ == WEB_VIEW) {
|
||||||
detach = true;
|
state = "detach";
|
||||||
} else if (args && args->Length() == 1) {
|
} else if (args && args->Length() == 1) {
|
||||||
|
bool detach = false;
|
||||||
mate::Dictionary options;
|
mate::Dictionary options;
|
||||||
args->GetNext(&options) && options.Get("detach", &detach);
|
if (args->GetNext(&options)) {
|
||||||
|
options.Get("mode", &state);
|
||||||
|
options.Get("detach", &detach);
|
||||||
|
if (state.empty() && detach)
|
||||||
|
state = "detach";
|
||||||
}
|
}
|
||||||
managed_web_contents()->SetCanDock(!detach);
|
}
|
||||||
|
managed_web_contents()->SetDockState(state);
|
||||||
managed_web_contents()->ShowDevTools();
|
managed_web_contents()->ShowDevTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -647,7 +647,8 @@ Removes the specified path from DevTools workspace.
|
||||||
### `webContents.openDevTools([options])`
|
### `webContents.openDevTools([options])`
|
||||||
|
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `detach` Boolean - opens DevTools in a new window
|
* `mode` String - Opens the devtools with specified dock state, can be one of
|
||||||
|
"right", "bottom", "undocked", "detach". Defaults to last used dock state.
|
||||||
|
|
||||||
Opens the devtools.
|
Opens the devtools.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue