mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 02:52:27 +08:00
client, server: Create option to control word wrapping for code blocks
This commit is contained in:
parent
52bc28def7
commit
b8569ea243
@ -23,6 +23,13 @@ const TPL = `
|
|||||||
<label>${t("highlighting.color-scheme")}</label>
|
<label>${t("highlighting.color-scheme")}</label>
|
||||||
<select class="theme-select form-select"></select>
|
<select class="theme-select form-select"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-6">
|
||||||
|
<label>Word wrapping</label>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="word-wrap form-check-input" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
@ -51,6 +58,9 @@ export default class CodeBlockOptions extends OptionsWidget {
|
|||||||
library_loader.loadHighlightingTheme(newTheme);
|
library_loader.loadHighlightingTheme(newTheme);
|
||||||
await server.put(`options/codeBlockTheme/${newTheme}`);
|
await server.put(`options/codeBlockTheme/${newTheme}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.$wordWrap = this.$widget.find(".word-wrap");
|
||||||
|
this.$wordWrap.on("change", () => this.updateCheckboxOption("codeBlockWordWrap", this.$wordWrap));
|
||||||
|
|
||||||
// Set up preview
|
// Set up preview
|
||||||
const sampleEl = this.$widget.find(".code-sample");
|
const sampleEl = this.$widget.find(".code-sample");
|
||||||
@ -74,5 +84,6 @@ export default class CodeBlockOptions extends OptionsWidget {
|
|||||||
.text(theme.title));
|
.text(theme.title));
|
||||||
}
|
}
|
||||||
this.$themeSelect.val(options.codeBlockTheme);
|
this.$themeSelect.val(options.codeBlockTheme);
|
||||||
|
this.setCheckboxState(this.$wordWrap, options.codeBlockWordWrap);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,6 +17,7 @@ const ALLOWED_OPTIONS = new Set([
|
|||||||
'zoomFactor',
|
'zoomFactor',
|
||||||
'theme',
|
'theme',
|
||||||
'codeBlockTheme',
|
'codeBlockTheme',
|
||||||
|
"codeBlockWordWrap",
|
||||||
'syncServerHost',
|
'syncServerHost',
|
||||||
'syncServerTimeout',
|
'syncServerTimeout',
|
||||||
'syncProxy',
|
'syncProxy',
|
||||||
|
@ -100,7 +100,9 @@ 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 },
|
||||||
|
|
||||||
|
{ name: "codeBlockWordWrap", value: "false", isSynced: true }
|
||||||
];
|
];
|
||||||
|
|
||||||
function initStartupOptions() {
|
function initStartupOptions() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user