Merge pull request #1991 from NguyenTranHoangSym/SDA-4374_main

SDA-4374: Devtool will now depend on config
This commit is contained in:
NguyenTranHoangSym 2023-10-25 08:33:11 +07:00 committed by GitHub
commit 9b6eabfd82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -16,7 +16,9 @@ export default class LocalMenuShortcuts {
new MenuItem(
this.getMenuItemOptions({
accelerator: isMac ? 'Alt+Command+I' : 'Ctrl+Shift+I',
click: () => windowHandler.onRegisterDevtools(),
click: () => {
windowHandler.onRegisterDevtools();
},
}),
),
);

View File

@ -460,6 +460,7 @@ export class WindowHandler {
windowHandler.switchClient(clientSwitchType);
}, SHORTCUT_KEY_THROTTLE);
this.mainWebContents.on('before-input-event', (event, input) => {
const { devToolsEnabled } = config.getConfigFields(['devToolsEnabled']);
const windowsDevTools =
input.control && input.shift && input.key.toLowerCase() === 'i';
const macDevTools =
@ -467,7 +468,7 @@ export class WindowHandler {
if (input.control && input.shift && input.key.toLowerCase() === 'd') {
event.preventDefault();
throttledExportLogs();
} else if (windowsDevTools || macDevTools) {
} else if (devToolsEnabled && (windowsDevTools || macDevTools)) {
event.preventDefault();
this.mainWebContents?.toggleDevTools();
}