diff --git a/apps/client/src/services/library_loader.ts b/apps/client/src/services/library_loader.ts index fc1b53f10..7197d6732 100644 --- a/apps/client/src/services/library_loader.ts +++ b/apps/client/src/services/library_loader.ts @@ -31,7 +31,6 @@ const HIGHLIGHT_JS: Library = { } } - const currentTheme = String(optionsService.get("codeBlockTheme")); loadHighlightingTheme(currentTheme); return Array.from(scriptsToLoad); diff --git a/apps/client/src/services/syntax_highlight.ts b/apps/client/src/services/syntax_highlight.ts index 866344a72..39eb3e71f 100644 --- a/apps/client/src/services/syntax_highlight.ts +++ b/apps/client/src/services/syntax_highlight.ts @@ -1,4 +1,4 @@ -import { ensureMimeTypes, highlight, highlightAuto } from "@triliumnext/highlightjs"; +import { ensureMimeTypes, highlight, highlightAuto, loadTheme } from "@triliumnext/highlightjs"; import mime_types from "./mime_types.js"; import options from "./options.js"; @@ -57,6 +57,11 @@ export async function applySingleBlockSyntaxHighlight($codeBlock: JQuery") + .attr("value", `default:${name}`) + .text(name); + this.$themeSelect.append(option); + } this.$themeSelect.on("change", async () => { const newTheme = String(this.$themeSelect.val()); library_loader.loadHighlightingTheme(newTheme); @@ -107,25 +115,6 @@ export default class CodeBlockOptions extends OptionsWidget { } async optionsLoaded(options: OptionMap) { - const themeGroups = await server.get("options/codeblock-themes"); - this.$themeSelect.empty(); - - for (const [key, themes] of Object.entries(themeGroups)) { - const $group = key ? $("").attr("label", key) : null; - - for (const theme of themes) { - const option = $("