Skip to content

Build your personal knowledge base with Trilium Notes

feat(backend_log): support customizable word wrap

Elian Doran36a6130ad85d
diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx
index 651f4a8b54..9193004e67 100644
--- a/apps/client/src/widgets/ribbon/NoteActions.tsx
+++ b/apps/client/src/widgets/ribbon/NoteActions.tsx
@@ -118,7 +118,7 @@ export function NoteContextMenu({ note, noteContext, itemsAtStart, itemsNearNote
>
{itemsAtStart}
- {note.type === "code" && <CodeProperties note={note} />}
+ {(note.type === "code" || note.noteId === "_backendLog") && <CodeProperties note={note} />}
{isReadOnly && <>
<CommandItem icon="bx bx-pencil" text={t("read-only-info.edit-note")}
diff --git a/apps/client/src/widgets/type_widgets/code/BackendLog.tsx b/apps/client/src/widgets/type_widgets/code/BackendLog.tsx
index 64cc264c36..1436c18135 100644
--- a/apps/client/src/widgets/type_widgets/code/BackendLog.tsx
+++ b/apps/client/src/widgets/type_widgets/code/BackendLog.tsx
@@ -4,13 +4,15 @@ import CodeMirror from "@triliumnext/codemirror";
import { useEffect, useRef, useState } from "preact/hooks";
import server from "../../../services/server";
-import { useTriliumEvent } from "../../react/hooks";
+import { useNote, useNoteLabelOptionalBool, useTriliumEvent } from "../../react/hooks";
import { TypeWidgetProps } from "../type_widget";
import { CodeEditor } from "./Code";
export default function BackendLog({ ntxId, parentComponent }: TypeWidgetProps) {
const [ content, setContent ] = useState<string>();
const editorRef = useRef<CodeMirror>(null);
+ const note = useNote("_backendLog");
+ const [ noteWrapLines ] = useNoteLabelOptionalBool(note, "wrapLines");
function refresh() {
server.get<string>("backend-log").then(content => {
@@ -40,6 +42,7 @@ export default function BackendLog({ ntxId, parentComponent }: TypeWidgetProps)
mime="text/plain"
readOnly
preferPerformance
+ {...(noteWrapLines != null && { lineWrapping: noteWrapLines })}
/>
</div>
);