fix(electron): devtools open in detach mode (#8200)

fix AF-1380
This commit is contained in:
pengx17 2024-09-12 03:20:19 +00:00
parent 8bf0458ef4
commit 24bf1beac8
No known key found for this signature in database
GPG Key ID: 23F23D9E8B3971ED
2 changed files with 12 additions and 4 deletions

View File

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

View File

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