Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
HUE-8621 [editor] Add ace option to toggle dark mode
This also persists the setting in total storage
  • Loading branch information
JohanAhlen committed Oct 15, 2018
1 parent c3f760b commit 79b63e4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js
Expand Up @@ -4865,7 +4865,8 @@
aceErrorsSub.dispose();
});

editor.setTheme($.totalStorage("hue.ace.theme") || "ace/theme/hue");
var darkThemeEnabled = ApiHelper.getInstance().getFromTotalStorage('ace', 'dark.theme.enabled', false);
editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');

var editorOptions = {
enableSnippets: true,
Expand All @@ -4884,6 +4885,14 @@
};

editor.customMenuOptions = {
setEnableDarkTheme: function (enabled) {
darkThemeEnabled = enabled;
ApiHelper.getInstance().setInTotalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');
},
getEnableDarkTheme: function () {
return darkThemeEnabled;
},
setEnableAutocompleter: function (enabled) {
editor.setOption('enableBasicAutocompletion', enabled);
snippet.getApiHelper().setInTotalStorage('hue.ace', 'enableBasicAutocompletion', enabled);
Expand Down

0 comments on commit 79b63e4

Please sign in to comment.