mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +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)) {
|
||||
const $group = key ? $("<optgroup>").attr("label", key) : null;
|
||||
|
||||
for (const [id, theme] of Object.entries(themes)) {
|
||||
for (const theme of themes) {
|
||||
const option = $("<option>")
|
||||
.attr("value", "default:" + id)
|
||||
.text(theme.name);
|
||||
.attr("value", theme.val)
|
||||
.text(theme.title);
|
||||
|
||||
if ($group) {
|
||||
$group.append(option);
|
||||
@ -129,19 +129,36 @@ export default class CodeBlockOptions extends OptionsWidget {
|
||||
}
|
||||
}
|
||||
|
||||
interface ThemeData {
|
||||
val: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
function groupThemesByLightOrDark() {
|
||||
const darkThemes: Record<string, Theme> = {};
|
||||
const lightThemes: Record<string, Theme> = {};
|
||||
const darkThemes: ThemeData[] = [];
|
||||
const lightThemes: ThemeData[] = [];
|
||||
|
||||
for (const [ id, theme ] of Object.entries(Themes)) {
|
||||
const data: ThemeData = {
|
||||
val: "default:" + id,
|
||||
title: theme.name
|
||||
};
|
||||
|
||||
if (theme.name.includes("Dark")) {
|
||||
darkThemes[id] = theme;
|
||||
darkThemes.push(data);
|
||||
} 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_dark")] = darkThemes;
|
||||
return output;
|
||||
|
Loading…
x
Reference in New Issue
Block a user