Skip to content

Commit 4f9ede1

Browse files
authored
Merge pull request #775 from FathyMuhamed/feat/add-editor-theme-command
feat(Command Menu): add editor theme option with translations
2 parents 5839c26 + 191a0b0 commit 4f9ede1

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/livecodes/UI/command-menu-actions.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Config, INinjaAction, TemplateName } from '../models';
1+
import type { Config, INinjaAction, Screen, TemplateName } from '../models';
22
import { appLanguages } from '../i18n/app-languages';
33
import { languageIsEnabled, languages, processorIsEnabled, processors } from '../languages';
44
import { isMac, predefinedValues, stringUnionToArray } from '../utils/utils';
@@ -12,6 +12,7 @@ export const getCommandMenuActions = ({
1212
loadStarterTemplate: (templateName: TemplateName) => Promise<void>;
1313
changeEditorSettings: (config: Partial<Config>) => void;
1414
changeLayout: (layout: Config['layout']) => void;
15+
showScreen: (screen: Screen['screen'], options?: any) => Promise<void>;
1516
};
1617
}) => {
1718
const { getConfig, loadStarterTemplate, changeEditorSettings, changeLayout } = deps;
@@ -947,6 +948,17 @@ export const getCommandMenuActions = ({
947948
UI.getThemeColorContainer()?.querySelector('input')?.click();
948949
},
949950
},
951+
{
952+
id: 'editor theme',
953+
title: window.deps.translateString('editorSettings.editorTheme', 'Editor Theme'),
954+
content: getContent('Editor Theme'),
955+
mdIcon: 'palette',
956+
handler: () => {
957+
deps.showScreen('editor-settings', {
958+
scrollToSelector: ':has(+ label[data-name^="editorTheme"])',
959+
});
960+
},
961+
},
950962
],
951963
},
952964
{

src/livecodes/core.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,6 +2665,7 @@ const handleKeyboardShortcutsScreen = () => {
26652665
loadStarterTemplate,
26662666
changeEditorSettings,
26672667
changeLayout: changeAndSaveLayout,
2668+
showScreen,
26682669
},
26692670
});
26702671

@@ -2738,6 +2739,7 @@ const handleCommandMenu = async () => {
27382739
loadStarterTemplate,
27392740
changeEditorSettings,
27402741
changeLayout: changeAndSaveLayout,
2742+
showScreen,
27412743
},
27422744
});
27432745
const authAction = authService?.isLoggedIn() ? logoutAction : loginAction;

0 commit comments

Comments
 (0)