mirror of https://github.com/TriliumNext/Notes
client/options/code notes: create the "Editor" section, reorganize
parent
0e748fbce0
commit
88aa9a4e79
@ -0,0 +1,39 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>${t("code-editor-options.title")}</h4>
|
||||
<label class="tn-checkbox">
|
||||
<input type="checkbox" class="vim-keymap-enabled form-check-input">
|
||||
${t("vim_key_bindings.use_vim_keybindings_in_code_notes")}
|
||||
</label>
|
||||
<p class="form-text">${t("vim_key_bindings.enable_vim_keybindings")}</p>
|
||||
|
||||
<label class="tn-checkbox">
|
||||
<input type="checkbox" class="line-wrap-enabled form-check-input">
|
||||
${t("wrap_lines.wrap_lines_in_code_notes")}
|
||||
</label>
|
||||
<p class="form-text">${t("wrap_lines.enable_line_wrap")}</p>
|
||||
</div>`;
|
||||
|
||||
export default class CodeEditorOptions extends OptionsWidget {
|
||||
|
||||
private $vimKeymapEnabled!: JQuery<HTMLElement>;
|
||||
private $codeLineWrapEnabled!: JQuery<HTMLElement>;
|
||||
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$vimKeymapEnabled = this.$widget.find(".vim-keymap-enabled");
|
||||
this.$vimKeymapEnabled.on("change", () => this.updateCheckboxOption("vimKeymapEnabled", this.$vimKeymapEnabled));
|
||||
|
||||
this.$codeLineWrapEnabled = this.$widget.find(".line-wrap-enabled");
|
||||
this.$codeLineWrapEnabled.on("change", () => this.updateCheckboxOption("codeLineWrapEnabled", this.$codeLineWrapEnabled));
|
||||
}
|
||||
|
||||
async optionsLoaded(options: OptionMap) {
|
||||
this.setCheckboxState(this.$vimKeymapEnabled, options.vimKeymapEnabled);
|
||||
this.setCheckboxState(this.$codeLineWrapEnabled, options.codeLineWrapEnabled);
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>${t("vim_key_bindings.use_vim_keybindings_in_code_notes")}</h4>
|
||||
<label class="tn-checkbox">
|
||||
<input type="checkbox" class="vim-keymap-enabled form-check-input">
|
||||
${t("vim_key_bindings.enable_vim_keybindings")}
|
||||
</label>
|
||||
</div>`;
|
||||
|
||||
export default class VimKeyBindingsOptions extends OptionsWidget {
|
||||
|
||||
private $vimKeymapEnabled!: JQuery<HTMLElement>;
|
||||
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$vimKeymapEnabled = this.$widget.find(".vim-keymap-enabled");
|
||||
this.$vimKeymapEnabled.on("change", () => this.updateCheckboxOption("vimKeymapEnabled", this.$vimKeymapEnabled));
|
||||
}
|
||||
|
||||
async optionsLoaded(options: OptionMap) {
|
||||
this.setCheckboxState(this.$vimKeymapEnabled, options.vimKeymapEnabled);
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import type { OptionMap } from "../../../../../../services/options_interface.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>${t("wrap_lines.wrap_lines_in_code_notes")}</h4>
|
||||
<label class="tn-checkbox">
|
||||
<input type="checkbox" class="line-wrap-enabled form-check-input">
|
||||
${t("wrap_lines.enable_line_wrap")}
|
||||
</label>
|
||||
</div>`;
|
||||
|
||||
export default class WrapLinesOptions extends OptionsWidget {
|
||||
|
||||
private $codeLineWrapEnabled!: JQuery<HTMLElement>;
|
||||
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$codeLineWrapEnabled = this.$widget.find(".line-wrap-enabled");
|
||||
this.$codeLineWrapEnabled.on("change", () => this.updateCheckboxOption("codeLineWrapEnabled", this.$codeLineWrapEnabled));
|
||||
}
|
||||
|
||||
async optionsLoaded(options: OptionMap) {
|
||||
this.setCheckboxState(this.$codeLineWrapEnabled, options.codeLineWrapEnabled);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue