提交 40ff4e42 编写于 作者: B Benjamin Pasero

title - smarter devtools handling with custom title

上级 0974c596
......@@ -660,7 +660,12 @@ export class VSCodeMenu {
private toggleDevTools(): void {
const w = this.windowsService.getFocusedWindow();
if (w && w.win) {
w.win.webContents.toggleDevTools();
const contents = w.win.webContents;
if (w.hasHiddenTitleBarStyle() && !w.win.isFullScreen() && !contents.isDevToolsOpened()) {
contents.openDevTools({ mode: 'undocked' }); // due to https://github.com/electron/electron/issues/3647
} else {
contents.toggleDevTools();
}
}
}
......
......@@ -227,6 +227,10 @@ export class VSCodeWindow {
this.registerListeners();
}
public hasHiddenTitleBarStyle(): boolean {
return this.options && this.options.titleBarStyle === 'custom';
}
public get isPluginDevelopmentHost(): boolean {
return !!this._extensionDevelopmentPath;
}
......
......@@ -61,7 +61,12 @@ export class WindowsService implements IWindowsService {
const vscodeWindow = this.windowsMainService.getWindowById(windowId);
if (vscodeWindow) {
vscodeWindow.win.webContents.toggleDevTools();
const contents = vscodeWindow.win.webContents;
if (vscodeWindow.hasHiddenTitleBarStyle() && !vscodeWindow.win.isFullScreen() && !contents.isDevToolsOpened()) {
contents.openDevTools({ mode: 'undocked' }); // due to https://github.com/electron/electron/issues/3647
} else {
contents.toggleDevTools();
}
}
return TPromise.as(null);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册