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