mirror of
https://github.com/zadam/trilium.git
synced 2025-02-22 14:03:36 +08:00
enable line wrap for code editor
This commit is contained in:
parent
585398ad5c
commit
137ffcc4e3
1 changed files with 7 additions and 2 deletions
|
@ -32,7 +32,10 @@ async function show() {
|
||||||
lint: true,
|
lint: true,
|
||||||
gutters: ["CodeMirror-lint-markers"],
|
gutters: ["CodeMirror-lint-markers"],
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
tabindex: 100
|
tabindex: 100,
|
||||||
|
// we linewrap 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
|
||||||
|
lineWrapping: true
|
||||||
});
|
});
|
||||||
|
|
||||||
onNoteChange(noteDetailService.noteChanged);
|
onNoteChange(noteDetailService.noteChanged);
|
||||||
|
@ -43,7 +46,9 @@ async function show() {
|
||||||
const currentNote = noteDetailService.getCurrentNote();
|
const currentNote = noteDetailService.getCurrentNote();
|
||||||
|
|
||||||
// this needs to happen after the element is shown, otherwise the editor won't be refreshed
|
// this needs to happen after the element is shown, otherwise the editor won't be refreshed
|
||||||
codeEditor.setValue(currentNote.content);
|
// CodeMirror breaks pretty badly on null so even though it shouldn't happen (guarded by consistency check)
|
||||||
|
// we provide fallback
|
||||||
|
codeEditor.setValue(currentNote.content || "");
|
||||||
|
|
||||||
const info = CodeMirror.findModeByMIME(currentNote.mime);
|
const info = CodeMirror.findModeByMIME(currentNote.mime);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue