mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	client: Improve group for no theme
This commit is contained in:
		| @@ -88,11 +88,18 @@ export default class CodeBlockOptions extends OptionsWidget { | |||||||
|         this.$themeSelect.empty(); |         this.$themeSelect.empty(); | ||||||
|  |  | ||||||
|         for (const [ key, themes ] of Object.entries(themeGroups)) { |         for (const [ key, themes ] of Object.entries(themeGroups)) { | ||||||
|             const $group = $("<optgroup>").attr("label", key); |             const $group = (key ? $("<optgroup>").attr("label", key) : null); | ||||||
|  |  | ||||||
|             for (const theme of themes) { |             for (const theme of themes) { | ||||||
|                 $group.append($("<option>") |                 const option = $("<option>") | ||||||
|                     .attr("value", theme.val) |                     .attr("value", theme.val) | ||||||
|                     .text(theme.title)); |                     .text(theme.title); | ||||||
|  |  | ||||||
|  |                 if ($group) { | ||||||
|  |                     $group.append(option); | ||||||
|  |                 } else { | ||||||
|  |                     this.$themeSelect.append(option); | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|             this.$themeSelect.append($group); |             this.$themeSelect.append($group); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -10,15 +10,16 @@ interface ColorTheme { | |||||||
| export function listSyntaxHighlightingThemes() { | export function listSyntaxHighlightingThemes() { | ||||||
|     const path = "node_modules/@highlightjs/cdn-assets/styles"; |     const path = "node_modules/@highlightjs/cdn-assets/styles"; | ||||||
|     const systemThemes = readThemesFromFileSystem(path); |     const systemThemes = readThemesFromFileSystem(path); | ||||||
|     const allThemes = [ |  | ||||||
|         { |  | ||||||
|             val: "none", |  | ||||||
|             title: t("code_block.theme_none") |  | ||||||
|         }, |  | ||||||
|         ...systemThemes |  | ||||||
|     ]; |  | ||||||
|  |  | ||||||
|     return groupThemesByLightOrDark(allThemes); |     return { | ||||||
|  |         "": [ | ||||||
|  |             { | ||||||
|  |                 val: "none", | ||||||
|  |                 title: t("code_block.theme_none") | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         ...groupThemesByLightOrDark(systemThemes) | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| function readThemesFromFileSystem(path: string): ColorTheme[] { | function readThemesFromFileSystem(path: string): ColorTheme[] { | ||||||
|   | |||||||
| @@ -185,7 +185,7 @@ | |||||||
|     "search_prefix": "Search:" |     "search_prefix": "Search:" | ||||||
|   }, |   }, | ||||||
|   "code_block": { |   "code_block": { | ||||||
|     "theme_none": "None", |     "theme_none": "No syntax highlighting", | ||||||
|     "theme_group_light": "Light themes", |     "theme_group_light": "Light themes", | ||||||
|     "theme_group_dark": "Dark themes" |     "theme_group_dark": "Dark themes" | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -185,7 +185,7 @@ | |||||||
|     "search_prefix": "Căutare:" |     "search_prefix": "Căutare:" | ||||||
|   }, |   }, | ||||||
|   "code_block": { |   "code_block": { | ||||||
|     "theme_none": "Niciuna", |     "theme_none": "Fără evidențiere de sintaxă", | ||||||
|     "theme_group_dark": "Teme întunecate", |     "theme_group_dark": "Teme întunecate", | ||||||
|     "theme_group_light": "Teme luminoase" |     "theme_group_light": "Teme luminoase" | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user