mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	chore(highlightjs): reintroduce no syntax highlight
This commit is contained in:
		
							parent
							
								
									4537dfa660
								
							
						
					
					
						commit
						6c70bd6ed6
					
				| @ -74,10 +74,10 @@ export default class CodeBlockOptions extends OptionsWidget { | |||||||
|         for (const [key, themes] of Object.entries(themeGroups)) { |         for (const [key, themes] of Object.entries(themeGroups)) { | ||||||
|             const $group = key ? $("<optgroup>").attr("label", key) : null; |             const $group = key ? $("<optgroup>").attr("label", key) : null; | ||||||
| 
 | 
 | ||||||
|             for (const [id, theme] of Object.entries(themes)) { |             for (const theme of themes) { | ||||||
|                 const option = $("<option>") |                 const option = $("<option>") | ||||||
|                     .attr("value", "default:" + id) |                     .attr("value", theme.val) | ||||||
|                     .text(theme.name); |                     .text(theme.title); | ||||||
| 
 | 
 | ||||||
|                 if ($group) { |                 if ($group) { | ||||||
|                     $group.append(option); |                     $group.append(option); | ||||||
| @ -129,19 +129,36 @@ export default class CodeBlockOptions extends OptionsWidget { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | interface ThemeData { | ||||||
|  |     val: string; | ||||||
|  |     title: string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function groupThemesByLightOrDark() { | function groupThemesByLightOrDark() { | ||||||
|     const darkThemes: Record<string, Theme> = {}; |     const darkThemes: ThemeData[] = []; | ||||||
|     const lightThemes: Record<string, Theme> = {}; |     const lightThemes: ThemeData[] = []; | ||||||
| 
 | 
 | ||||||
|     for (const [ id, theme ] of Object.entries(Themes)) { |     for (const [ id, theme ] of Object.entries(Themes)) { | ||||||
|  |         const data: ThemeData = { | ||||||
|  |             val: "default:" + id, | ||||||
|  |             title: theme.name | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|         if (theme.name.includes("Dark")) { |         if (theme.name.includes("Dark")) { | ||||||
|             darkThemes[id] = theme; |             darkThemes.push(data); | ||||||
|         } else { |         } else { | ||||||
|             lightThemes[id] = theme; |             lightThemes.push(data); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const output: Record<string, Record<string, Theme>> = {}; |     const output: Record<string, ThemeData[]> = { | ||||||
|  |         "": [ | ||||||
|  |             { | ||||||
|  |                 val: "none", | ||||||
|  |                 title: t("code_block.theme_none") | ||||||
|  |             } | ||||||
|  |         ] | ||||||
|  |     }; | ||||||
|     output[t("code_block.theme_group_light")] = lightThemes; |     output[t("code_block.theme_group_light")] = lightThemes; | ||||||
|     output[t("code_block.theme_group_dark")] = darkThemes; |     output[t("code_block.theme_group_dark")] = darkThemes; | ||||||
|     return output; |     return output; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran