From 6ea3b7786196ad85544672f720d250817ea7a7fc Mon Sep 17 00:00:00 2001 From: NguyenTranHoangSym Date: Tue, 24 Oct 2023 15:27:56 +0700 Subject: [PATCH] SDA-4374: Devtool will now depend on config --- src/app/local-menu-shortcuts.ts | 4 +++- src/app/window-handler.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/local-menu-shortcuts.ts b/src/app/local-menu-shortcuts.ts index 22814ccc..d3867621 100644 --- a/src/app/local-menu-shortcuts.ts +++ b/src/app/local-menu-shortcuts.ts @@ -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(); + }, }), ), ); diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index 7022806b..d6464033 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -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(); }