mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-30 03:32:26 +08:00
client: Allow switching theme
This commit is contained in:
parent
7354fb5b4a
commit
60b6f7df89
@ -18,6 +18,10 @@ export default class HighlightingOptions extends OptionsWidget {
|
|||||||
doRender() {
|
doRender() {
|
||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
this.$themeSelect = this.$widget.find(".theme-select");
|
this.$themeSelect = this.$widget.find(".theme-select");
|
||||||
|
this.$themeSelect.on("change", async () => {
|
||||||
|
const newTheme = this.$themeSelect.val();
|
||||||
|
await server.put(`options/highlightingTheme/${newTheme}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async optionsLoaded(options) {
|
async optionsLoaded(options) {
|
||||||
@ -27,8 +31,8 @@ export default class HighlightingOptions extends OptionsWidget {
|
|||||||
for (const theme of themes) {
|
for (const theme of themes) {
|
||||||
this.$themeSelect.append($("<option>")
|
this.$themeSelect.append($("<option>")
|
||||||
.attr("value", theme.val)
|
.attr("value", theme.val)
|
||||||
.text(theme.title)
|
.text(theme.title));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
this.$themeSelect.val(options.highlightingTheme);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,6 +16,7 @@ const ALLOWED_OPTIONS = new Set([
|
|||||||
'revisionSnapshotNumberLimit',
|
'revisionSnapshotNumberLimit',
|
||||||
'zoomFactor',
|
'zoomFactor',
|
||||||
'theme',
|
'theme',
|
||||||
|
'highlightingTheme',
|
||||||
'syncServerHost',
|
'syncServerHost',
|
||||||
'syncServerTimeout',
|
'syncServerTimeout',
|
||||||
'syncProxy',
|
'syncProxy',
|
||||||
|
@ -41,6 +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('syncServerHost', opts.syncServerHost || '', false);
|
optionService.createOption('syncServerHost', opts.syncServerHost || '', false);
|
||||||
optionService.createOption('syncServerTimeout', '120000', false);
|
optionService.createOption('syncServerTimeout', '120000', false);
|
||||||
@ -99,7 +100,7 @@ const defaultOptions: DefaultOption[] = [
|
|||||||
|
|
||||||
// Internationalization
|
// Internationalization
|
||||||
{ name: 'locale', value: 'en', isSynced: true },
|
{ name: 'locale', value: 'en', isSynced: true },
|
||||||
{ name: 'firstDayOfWeek', value: '1', isSynced: true }
|
{ name: 'firstDayOfWeek', value: '1', isSynced: true }
|
||||||
];
|
];
|
||||||
|
|
||||||
function initStartupOptions() {
|
function initStartupOptions() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user