mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 11:02:28 +08: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 = [
|
||||
{
|
||||
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[] {
|
||||
|
@ -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