mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
small tweaks of linewrap option
This commit is contained in:
parent
acf3f5013c
commit
76f34e3eaf
@ -2,19 +2,22 @@ import mimeTypesService from "../../../services/mime_types.js";
|
|||||||
import options from "../../../services/options.js";
|
import options from "../../../services/options.js";
|
||||||
import server from "../../../services/server.js";
|
import server from "../../../services/server.js";
|
||||||
import toastService from "../../../services/toast.js";
|
import toastService from "../../../services/toast.js";
|
||||||
import utils from "../../../services/utils.js";
|
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<h4>Use vim keybindings in CodeNotes (no ex mode)</h4>
|
<h4>Use vim keybindings in code notes (no ex mode)</h4>
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="vim-keymap-enabled">
|
<input type="checkbox" class="custom-control-input" id="vim-keymap-enabled">
|
||||||
<label class="custom-control-label" for="vim-keymap-enabled">Enable Vim Keybindings</label>
|
<label class="custom-control-label" for="vim-keymap-enabled">Enable Vim Keybindings</label>
|
||||||
</div>
|
</div>
|
||||||
<h4>Wrap lines in CodeNotes</h4>
|
<br/>
|
||||||
|
|
||||||
|
<h4>Wrap lines in code notes</h4>
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="linewrap-enabled">
|
<input type="checkbox" class="custom-control-input" id="line-wrap-enabled">
|
||||||
<label class="custom-control-label" for="linewrap-enabled">Enable Linewrap</label>
|
<label class="custom-control-label" for="line-wrap-enabled">Enable Line Wrap (change might need a frontend reload to take effect)</label>
|
||||||
</div>
|
</div>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<h4>Available MIME types in the dropdown</h4>
|
<h4>Available MIME types in the dropdown</h4>
|
||||||
|
|
||||||
<ul id="options-mime-types" style="max-height: 500px; overflow: auto; list-style-type: none;"></ul>`;
|
<ul id="options-mime-types" style="max-height: 500px; overflow: auto; list-style-type: none;"></ul>`;
|
||||||
@ -29,9 +32,9 @@ export default class CodeNotesOptions {
|
|||||||
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
this.$linewrapEnabled = $("#linewrap-enabled");
|
this.$codeLineWrapEnabled = $("#line-wrap-enabled");
|
||||||
this.$linewrapEnabled.on('change', () => {
|
this.$codeLineWrapEnabled.on('change', () => {
|
||||||
const opts = { 'linewrapEnabled': this.$linewrapEnabled.is(":checked") ? "true" : "false" };
|
const opts = { 'codeLineWrapEnabled': this.$codeLineWrapEnabled.is(":checked") ? "true" : "false" };
|
||||||
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -41,7 +44,7 @@ export default class CodeNotesOptions {
|
|||||||
async optionsLoaded(options) {
|
async optionsLoaded(options) {
|
||||||
this.$mimeTypes.empty();
|
this.$mimeTypes.empty();
|
||||||
this.$vimKeymapEnabled.prop("checked", options['vimKeymapEnabled'] === 'true');
|
this.$vimKeymapEnabled.prop("checked", options['vimKeymapEnabled'] === 'true');
|
||||||
this.$linewrapEnabled.prop("checked", options['linewrapEnabled'] === 'true');
|
this.$codeLineWrapEnabled.prop("checked", options['codeLineWrapEnabled'] === 'true');
|
||||||
let idCtr = 1;
|
let idCtr = 1;
|
||||||
|
|
||||||
for (const mimeType of await mimeTypesService.getMimeTypes()) {
|
for (const mimeType of await mimeTypesService.getMimeTypes()) {
|
||||||
|
@ -58,9 +58,9 @@ export default class EditableCodeTypeWidget extends TypeWidget {
|
|||||||
gutters: ["CodeMirror-lint-markers"],
|
gutters: ["CodeMirror-lint-markers"],
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
tabindex: 300,
|
tabindex: 300,
|
||||||
// we linewrap partly also because without it horizontal scrollbar displays only when you scroll
|
// we line wrap partly also because without it horizontal scrollbar displays only when you scroll
|
||||||
// all the way to the bottom of the note. With line wrap there's no horizontal scrollbar so no problem
|
// all the way to the bottom of the note. With line wrap there's no horizontal scrollbar so no problem
|
||||||
lineWrapping: options.is('linewrapEnabled'),
|
lineWrapping: options.is('codeLineWrapEnabled'),
|
||||||
dragDrop: false, // with true the editor inlines dropped files which is not what we expect
|
dragDrop: false, // with true the editor inlines dropped files which is not what we expect
|
||||||
placeholder: "Type the content of your code note here..."
|
placeholder: "Type the content of your code note here..."
|
||||||
});
|
});
|
||||||
|
@ -33,7 +33,7 @@ const ALLOWED_OPTIONS = new Set([
|
|||||||
'editedNotesWidget',
|
'editedNotesWidget',
|
||||||
'calendarWidget',
|
'calendarWidget',
|
||||||
'vimKeymapEnabled',
|
'vimKeymapEnabled',
|
||||||
'linewrapEnabled',
|
'codeLineWrapEnabled',
|
||||||
'codeNotesMimeTypes',
|
'codeNotesMimeTypes',
|
||||||
'spellCheckEnabled',
|
'spellCheckEnabled',
|
||||||
'spellCheckLanguageCode',
|
'spellCheckLanguageCode',
|
||||||
|
@ -62,7 +62,7 @@ const defaultOptions = [
|
|||||||
{ name: 'imageJpegQuality', value: '75', isSynced: true },
|
{ name: 'imageJpegQuality', value: '75', isSynced: true },
|
||||||
{ name: 'autoFixConsistencyIssues', value: 'true', isSynced: false },
|
{ name: 'autoFixConsistencyIssues', value: 'true', isSynced: false },
|
||||||
{ name: 'vimKeymapEnabled', value: 'false', isSynced: false },
|
{ name: 'vimKeymapEnabled', value: 'false', isSynced: false },
|
||||||
{ name: 'linewrapEnabled', value: 'true', isSynced: false },
|
{ name: 'codeLineWrapEnabled', value: 'true', isSynced: false },
|
||||||
{ name: 'codeNotesMimeTypes', value: '["text/x-csrc","text/x-c++src","text/x-csharp","text/css","text/x-go","text/x-groovy","text/x-haskell","text/html","message/http","text/x-java","application/javascript;env=frontend","application/javascript;env=backend","application/json","text/x-kotlin","text/x-markdown","text/x-perl","text/x-php","text/x-python","text/x-ruby",null,"text/x-sql","text/x-sqlite;schema=trilium","text/x-swift","text/xml","text/x-yaml"]', isSynced: true },
|
{ name: 'codeNotesMimeTypes', value: '["text/x-csrc","text/x-c++src","text/x-csharp","text/css","text/x-go","text/x-groovy","text/x-haskell","text/html","message/http","text/x-java","application/javascript;env=frontend","application/javascript;env=backend","application/json","text/x-kotlin","text/x-markdown","text/x-perl","text/x-php","text/x-python","text/x-ruby",null,"text/x-sql","text/x-sqlite;schema=trilium","text/x-swift","text/xml","text/x-yaml"]', isSynced: true },
|
||||||
{ name: 'leftPaneWidth', value: '25', isSynced: false },
|
{ name: 'leftPaneWidth', value: '25', isSynced: false },
|
||||||
{ name: 'leftPaneVisible', value: 'true', isSynced: false },
|
{ name: 'leftPaneVisible', value: 'true', isSynced: false },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user