Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(code): adjustable word wrap at note level
Elian Doranc691a9c6e698
diff --git a/apps/client/src/widgets/type_widgets/code/Code.tsx b/apps/client/src/widgets/type_widgets/code/Code.tsxindex 17ef41c941..4f34edd96b 100644--- a/apps/client/src/widgets/type_widgets/code/Code.tsx+++ b/apps/client/src/widgets/type_widgets/code/Code.tsx@@ -38,6 +38,7 @@ export function ReadOnlyCode({ note, viewScope, ntxId, parentComponent }: TypeWiconst blob = useNoteBlob(note);const [ noteTabWidth ] = useNoteLabelInt(note, "tabWidth");const [ noteUseTabs ] = useNoteLabelOptionalBool(note, "indentWithTabs");+ const [ noteWrapLines ] = useNoteLabelOptionalBool(note, "wrapLines");useEffect(() => {if (!blob) return;@@ -59,6 +60,7 @@ export function ReadOnlyCode({ note, viewScope, ntxId, parentComponent }: TypeWireadOnly{...(noteTabWidth != null && { indentSize: noteTabWidth })}{...(noteUseTabs != null && { useTabs: noteUseTabs })}+ {...(noteWrapLines != null && { lineWrapping: noteWrapLines })}/>);}@@ -85,6 +87,7 @@ export function EditableCode({ note, ntxId, noteContext, debounceUpdate, parentCconst [ vimKeymapEnabled ] = useTriliumOptionBool("vimKeymapEnabled");const [ noteTabWidth ] = useNoteLabelInt(note, "tabWidth");const [ noteUseTabs ] = useNoteLabelOptionalBool(note, "indentWithTabs");+ const [ noteWrapLines ] = useNoteLabelOptionalBool(note, "wrapLines");const mime = useNoteProperty(note, "mime");const spacedUpdate = useEditorSpacedUpdate({note,@@ -137,6 +140,7 @@ export function EditableCode({ note, ntxId, noteContext, debounceUpdate, parentC{...editorProps}{...(noteTabWidth != null && { indentSize: noteTabWidth })}{...(noteUseTabs != null && { useTabs: noteUseTabs })}+ {...(noteWrapLines != null && { lineWrapping: noteWrapLines })}/><TouchBar>diff --git a/packages/commons/src/lib/attribute_names.ts b/packages/commons/src/lib/attribute_names.tsindex 340714e3d9..9b53e784e3 100644--- a/packages/commons/src/lib/attribute_names.ts+++ b/packages/commons/src/lib/attribute_names.ts@@ -72,6 +72,7 @@ type Labels = {readOnly: boolean;tabWidth: number;indentWithTabs: boolean;+ wrapLines: boolean;mapType: string;mapRootNoteId: string;