mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-23 07:41:37 +08:00
fix(code): align syntax highlight settings
This commit is contained in:
parent
b2aec4dfdb
commit
340dec725c
@ -4,6 +4,8 @@ import options from "../../services/options.js";
|
||||
import TypeWidget from "./type_widget.js";
|
||||
import CodeMirror, { type EditorConfig } from "@triliumnext/codemirror";
|
||||
|
||||
export const DEFAULT_PREFIX = "default:";
|
||||
|
||||
/**
|
||||
* An abstract {@link TypeWidget} which implements the CodeMirror editor, meant to be used as a parent for
|
||||
* widgets requiring the editor.
|
||||
@ -34,9 +36,12 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
|
||||
});
|
||||
|
||||
// Load the theme.
|
||||
const theme = getThemeById(options.get("codeNoteTheme"));
|
||||
if (theme) {
|
||||
await this.codeEditor.setTheme(theme);
|
||||
const themeId = options.get("codeNoteTheme");
|
||||
if (themeId?.startsWith(DEFAULT_PREFIX)) {
|
||||
const theme = getThemeById(themeId.substring(DEFAULT_PREFIX.length));
|
||||
if (theme) {
|
||||
await this.codeEditor.setTheme(theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ function getSyntaxHighlightingThemes() {
|
||||
|
||||
function getCodeNoteThemes() {
|
||||
return ColorThemes.map((theme) => ({
|
||||
val: theme.id,
|
||||
val: `default:${theme.id}`,
|
||||
title: theme.id
|
||||
}));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user