fix(electron): do not always enable devtools detach mode (#8273)

This commit is contained in:
pengx17
2024-09-18 04:16:51 +00:00
parent 714b7b863e
commit 7a26c76e53
2 changed files with 4 additions and 12 deletions

View File

@@ -258,9 +258,7 @@ export async function openUrlInHiddenWindow(urlObj: URL) {
}); });
if (BUILD_CONFIG.debug) { if (BUILD_CONFIG.debug) {
win.webContents.openDevTools({ win.webContents.openDevTools();
mode: 'detach',
});
} }
win.on('close', e => { win.on('close', e => {

View File

@@ -817,9 +817,7 @@ export class WebContentViewsManager {
view.webContents.loadURL(shellViewUrl).catch(err => logger.error(err)); view.webContents.loadURL(shellViewUrl).catch(err => logger.error(err));
if (isDev) { if (isDev) {
view.webContents.openDevTools({ view.webContents.openDevTools();
mode: 'detach',
});
} }
} }
@@ -1003,17 +1001,13 @@ export const showDevTools = (id?: string) => {
getCustomThemeWindow() getCustomThemeWindow()
.then(w => { .then(w => {
if (w && w.isFocused()) { if (w && w.isFocused()) {
w.webContents.openDevTools({ w.webContents.openDevTools();
mode: 'detach',
});
} else { } else {
const view = id const view = id
? WebContentViewsManager.instance.getViewById(id) ? WebContentViewsManager.instance.getViewById(id)
: WebContentViewsManager.instance.activeWorkbenchView; : WebContentViewsManager.instance.activeWorkbenchView;
if (view) { if (view) {
view.webContents.openDevTools({ view.webContents.openDevTools();
mode: 'detach',
});
} }
} }
}) })