mirror of
https://github.com/zadam/trilium.git
synced 2026-01-03 13:14:24 +01:00
feat(options): list color themes
This commit is contained in:
parent
ca467fcd7a
commit
224b7f4826
@ -55,6 +55,7 @@ const TPL = /*html*/`
|
||||
</div>
|
||||
`;
|
||||
|
||||
// TODO: Deduplicate
|
||||
interface Theme {
|
||||
title: string;
|
||||
val: string;
|
||||
|
||||
@ -1,15 +1,45 @@
|
||||
import type { OptionMap } from "@triliumnext/commons";
|
||||
import OptionsWidget from "../options_widget";
|
||||
import server from "../../../../services/server";
|
||||
|
||||
// TODO: Deduplicate
|
||||
interface Theme {
|
||||
title: string;
|
||||
val: string;
|
||||
}
|
||||
|
||||
type Response = Theme[];
|
||||
|
||||
const TPL = /*html*/`\
|
||||
<div class="options-section">
|
||||
<h4>Color theme</h4>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-md-6">
|
||||
<label for="color-theme">Color scheme</label>
|
||||
<select id="color-theme" class="theme-select form-select"></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
export default class CodeTheme extends OptionsWidget {
|
||||
|
||||
private $themeSelect!: JQuery<HTMLElement>;
|
||||
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$themeSelect = this.$widget.find(".theme-select");
|
||||
}
|
||||
|
||||
async optionsLoaded(options: OptionMap) {
|
||||
const themes = await server.get<Response>("options/codenote-themes");
|
||||
this.$themeSelect.empty();
|
||||
|
||||
for (const theme of themes) {
|
||||
const option = $("<option>").attr("value", theme.val).text(theme.title);
|
||||
this.$themeSelect.append(option);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user