mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 02:42:27 +08:00
client: Rename option to codeBlockTheme
This commit is contained in:
parent
e68d070320
commit
96b9042559
@ -98,7 +98,7 @@ const HIGHLIGHT_JS = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentTheme = optionsService.get("highlightingTheme");
|
const currentTheme = optionsService.get("codeBlockTheme");
|
||||||
loadHighlightingTheme(currentTheme);
|
loadHighlightingTheme(currentTheme);
|
||||||
|
|
||||||
return Array.from(scriptsToLoad);
|
return Array.from(scriptsToLoad);
|
||||||
@ -158,6 +158,10 @@ async function requireCss(url, prependAssetPath = true) {
|
|||||||
|
|
||||||
let highlightingThemeEl = null;
|
let highlightingThemeEl = null;
|
||||||
function loadHighlightingTheme(theme) {
|
function loadHighlightingTheme(theme) {
|
||||||
|
if (!theme) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!highlightingThemeEl) {
|
if (!highlightingThemeEl) {
|
||||||
highlightingThemeEl = $(`<link rel="stylesheet" type="text/css" />`);
|
highlightingThemeEl = $(`<link rel="stylesheet" type="text/css" />`);
|
||||||
$("head").append(highlightingThemeEl);
|
$("head").append(highlightingThemeEl);
|
||||||
|
@ -46,7 +46,7 @@ export default class HighlightingOptions extends OptionsWidget {
|
|||||||
this.$themeSelect.on("change", async () => {
|
this.$themeSelect.on("change", async () => {
|
||||||
const newTheme = this.$themeSelect.val();
|
const newTheme = this.$themeSelect.val();
|
||||||
library_loader.loadHighlightingTheme(newTheme);
|
library_loader.loadHighlightingTheme(newTheme);
|
||||||
await server.put(`options/highlightingTheme/${newTheme}`);
|
await server.put(`options/codeBlockTheme/${newTheme}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set up preview
|
// Set up preview
|
||||||
@ -70,6 +70,6 @@ export default class HighlightingOptions extends OptionsWidget {
|
|||||||
.attr("value", theme.val)
|
.attr("value", theme.val)
|
||||||
.text(theme.title));
|
.text(theme.title));
|
||||||
}
|
}
|
||||||
this.$themeSelect.val(options.highlightingTheme);
|
this.$themeSelect.val(options.codeBlockTheme);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@ const ALLOWED_OPTIONS = new Set([
|
|||||||
'revisionSnapshotNumberLimit',
|
'revisionSnapshotNumberLimit',
|
||||||
'zoomFactor',
|
'zoomFactor',
|
||||||
'theme',
|
'theme',
|
||||||
'highlightingTheme',
|
'codeBlockTheme',
|
||||||
'syncServerHost',
|
'syncServerHost',
|
||||||
'syncServerTimeout',
|
'syncServerTimeout',
|
||||||
'syncProxy',
|
'syncProxy',
|
||||||
|
@ -41,7 +41,7 @@ async function initNotSyncedOptions(initialized: boolean, theme: string, opts: N
|
|||||||
optionService.createOption('lastSyncedPush', '0', false);
|
optionService.createOption('lastSyncedPush', '0', false);
|
||||||
|
|
||||||
optionService.createOption('theme', theme, false);
|
optionService.createOption('theme', theme, false);
|
||||||
optionService.createOption('highlightingTheme', "default:atom-one-dark", false);
|
optionService.createOption('codeBlockTheme', "default:atom-one-dark", false);
|
||||||
|
|
||||||
optionService.createOption('syncServerHost', opts.syncServerHost || '', false);
|
optionService.createOption('syncServerHost', opts.syncServerHost || '', false);
|
||||||
optionService.createOption('syncServerTimeout', '120000', false);
|
optionService.createOption('syncServerTimeout', '120000', false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user