mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
ELECTRON-676 - Fixing Developer Tools window flashes before the popup (#489)
This commit is contained in:
committed by
Vishwas Shashidhar
parent
f4f99b1c0c
commit
f17a5788b4
@@ -560,10 +560,6 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
|||||||
if (!isDevEnv) {
|
if (!isDevEnv) {
|
||||||
browserWin.webContents.session.setCertificateVerifyProc(handleCertificateTransparencyChecks);
|
browserWin.webContents.session.setCertificateVerifyProc(handleCertificateTransparencyChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
browserWin.webContents.on('devtools-opened', () => {
|
|
||||||
handleDevTools(browserWin);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -604,10 +600,6 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.webContents.on('devtools-opened', () => {
|
|
||||||
handleDevTools(mainWindow);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register shortcuts for the app
|
* Register shortcuts for the app
|
||||||
*/
|
*/
|
||||||
@@ -616,8 +608,20 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
|||||||
function devTools() {
|
function devTools() {
|
||||||
const focusedWindow = BrowserWindow.getFocusedWindow();
|
const focusedWindow = BrowserWindow.getFocusedWindow();
|
||||||
|
|
||||||
|
|
||||||
if (focusedWindow && !focusedWindow.isDestroyed()) {
|
if (focusedWindow && !focusedWindow.isDestroyed()) {
|
||||||
focusedWindow.webContents.toggleDevTools();
|
if (devToolsEnabled) {
|
||||||
|
focusedWindow.webContents.toggleDevTools();
|
||||||
|
} else {
|
||||||
|
log.send(logLevels.INFO, `dev tools disabled for ${focusedWindow.winName} window`);
|
||||||
|
focusedWindow.webContents.closeDevTools();
|
||||||
|
electron.dialog.showMessageBox(focusedWindow, {
|
||||||
|
type: 'warning',
|
||||||
|
buttons: ['Ok'],
|
||||||
|
title: i18n.getMessageFor('Dev Tools disabled'),
|
||||||
|
message: i18n.getMessageFor('Dev Tools has been disabled! Please contact your system administrator to enable it!'),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -729,21 +733,6 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
|||||||
return callback(-2);
|
return callback(-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDevTools(browserWindow) {
|
|
||||||
|
|
||||||
if (!devToolsEnabled) {
|
|
||||||
log.send(logLevels.INFO, `dev tools disabled for ${browserWindow.winName} window`);
|
|
||||||
browserWindow.webContents.closeDevTools();
|
|
||||||
electron.dialog.showMessageBox(browserWindow, {
|
|
||||||
type: 'warning',
|
|
||||||
buttons: ['Ok'],
|
|
||||||
title: i18n.getMessageFor('Dev Tools disabled'),
|
|
||||||
message: i18n.getMessageFor('Dev Tools has been disabled! Please contact your system administrator to enable it!'),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user