Skip to content

Build your personal knowledge base with Trilium Notes

client: Apply syntax highlight in real-time

Elian Doran2fdff29067c6
diff --git a/src/public/app/services/library_loader.js b/src/public/app/services/library_loader.js
index 1fee76f1a2..88ad4ec7df 100644
--- a/src/public/app/services/library_loader.js
+++ b/src/public/app/services/library_loader.js
@@ -177,6 +177,7 @@ function loadHighlightingTheme(theme) {
export default {
requireCss,
requireLibrary,
+ loadHighlightingTheme,
CKEDITOR,
CODE_MIRROR,
ESLINT,
diff --git a/src/public/app/widgets/type_widgets/options/appearance/highlighting.js b/src/public/app/widgets/type_widgets/options/appearance/highlighting.js
index 9e63960043..8d3eba80a4 100644
--- a/src/public/app/widgets/type_widgets/options/appearance/highlighting.js
+++ b/src/public/app/widgets/type_widgets/options/appearance/highlighting.js
@@ -1,3 +1,4 @@
+import library_loader from "../../../../services/library_loader.js";
import server from "../../../../services/server.js";
import OptionsWidget from "../options_widget.js";
@@ -20,6 +21,7 @@ export default class HighlightingOptions extends OptionsWidget {
this.$themeSelect = this.$widget.find(".theme-select");
this.$themeSelect.on("change", async () => {
const newTheme = this.$themeSelect.val();
+ library_loader.loadHighlightingTheme(newTheme);
await server.put(`options/highlightingTheme/${newTheme}`);
});
}