feat: add shortcut bind to open DevTools

This commit is contained in:
Aetherinox 2024-04-21 04:29:51 -07:00
parent 540d5f8dd4
commit 1d4b8d7f49
No known key found for this signature in database
GPG Key ID: CB5C4C30CD0D4028
3 changed files with 10 additions and 1 deletions

View File

@ -74,6 +74,7 @@ class AppView extends View {
this.listenTo(Events, 'select-all', this.selectAll);
this.listenTo(Events, 'menu-select', this.menuSelect);
this.listenTo(Events, 'lock-workspace', this.lockWorkspace);
this.listenTo(Events, 'open-devtools', this.openDevTools);
this.listenTo(Events, 'show-file', this.showFileSettings);
this.listenTo(Events, 'open-file', this.toggleOpenFile);
this.listenTo(Events, 'save-all', this.saveAll);
@ -475,7 +476,9 @@ class AppView extends View {
}
openDevTools() {
if (Launcher && Launcher.devTools) {
const logger = new Logger('launcher');
logger.info('Opening developer console...');
if (Launcher) {
Launcher.openDevTools();
}
}

View File

@ -28,6 +28,7 @@ class FooterView extends View {
this.onKey(Keys.DOM_VK_O, this.openFile, KeyHandler.SHORTCUT_ACTION);
this.onKey(Keys.DOM_VK_S, this.saveAll, KeyHandler.SHORTCUT_ACTION);
this.onKey(Keys.DOM_VK_COMMA, this.toggleSettings, KeyHandler.SHORTCUT_ACTION);
this.onKey(Keys.DOM_VK_I, this.openDevTools, KeyHandler.SHORTCUT_ACTION);
this.listenTo(this, 'hide', this.viewHidden);
this.listenTo(this.model.files, 'change', this.render);
@ -98,6 +99,10 @@ class FooterView extends View {
toggleSettings() {
Events.emit('toggle-settings', 'general');
}
openDevTools() {
Events.emit('open-devtools');
}
}
export { FooterView };

View File

@ -20,6 +20,7 @@
<div><span class="shortcut">{{cmd}}G</span> {{res 'setShGen'}}</div>
<div><span class="shortcut">{{cmd}},</span> {{res 'setShSet'}}</div>
<div><span class="shortcut">{{cmd}}L</span> {{res 'setShLock'}}</div>
<div><span class="shortcut">{{cmd}}I</span> {{res 'setDevConsole'}}</div>
{{#if globalShortcuts}}
<p>{{res 'setShGlobal'}}</p>
<div><button class="shortcut btn-silent {{#if globalIsLarge}}shortcut-large{{/if}}"