feat(code): adjustable word wrap at note level

This commit is contained in:
Elian Doran
2026-04-15 18:02:54 +03:00
parent 94e70c0318
commit c691a9c6e6
2 changed files with 5 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ export function ReadOnlyCode({ note, viewScope, ntxId, parentComponent }: TypeWi
const 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 }: TypeWi
readOnly
{...(noteTabWidth != null && { indentSize: noteTabWidth })}
{...(noteUseTabs != null && { useTabs: noteUseTabs })}
{...(noteWrapLines != null && { lineWrapping: noteWrapLines })}
/>
);
}
@@ -85,6 +87,7 @@ export function EditableCode({ note, ntxId, noteContext, debounceUpdate, parentC
const [ 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>

View File

@@ -72,6 +72,7 @@ type Labels = {
readOnly: boolean;
tabWidth: number;
indentWithTabs: boolean;
wrapLines: boolean;
mapType: string;
mapRootNoteId: string;