瀏覽代碼

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

Ctrl/Cmd-Alt-T
Johan Ahlen 7 年之前
父節點
當前提交
16fc2049fb
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

+ 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"},