Răsfoiți Sursa

HUE-8621 [editor] Add keyboard shortcut to toggle dark mode

Ctrl/Cmd-Alt-T
Johan Ahlen 7 ani în urmă
părinte
comite
16fc2049fb

+ 10 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -5444,6 +5444,16 @@
         }
       });
 
+      editor.commands.addCommand({
+        name: 'switchTheme',
+        bindKey: { win: 'Ctrl-Alt-t', mac: 'Command-Alt-t' },
+        exec: function () {
+          darkThemeEnabled = !darkThemeEnabled;
+          ApiHelper.getInstance().setInTotalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
+          editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');
+        }
+      });
+
       editor.commands.addCommand({
         name: "new",
         bindKey: {win: "Ctrl-e", mac: "Command-e"},