From f9de2cfd2bec3fafc4b50e94ebb07e9f604486d7 Mon Sep 17 00:00:00 2001 From: Timothy Cardoza Date: Fri, 27 Feb 2026 17:43:02 -0600 Subject: [PATCH] reactivitey for editability for note editing. --- src/components/TaskEditor.tsx | 8 ++++++++ src/views/NotepadView.tsx | 14 +++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/TaskEditor.tsx b/src/components/TaskEditor.tsx index 0797d10..0f11857 100644 --- a/src/components/TaskEditor.tsx +++ b/src/components/TaskEditor.tsx @@ -117,6 +117,14 @@ export const TaskEditor: Component = (props) => { } }); + // Make editor react to editable changes + createEffect(() => { + const e = editor(); + if (e && props.editable !== undefined) { + e.setEditable(props.editable); + } + }); + return ( <>
pb.authStore.model?.id; // Derived states const activeNote = createMemo(() => { @@ -159,8 +159,8 @@ export const NotepadView: Component<{
}> {(note) => { - const isOwner = note().user === currentUserId; - const canEdit = isOwner || !note().isPrivate; + const isOwner = () => note().user === currentUserId(); + const canEdit = () => isOwner() || !note().isPrivate; return ( <> @@ -180,14 +180,14 @@ export const NotepadView: Component<{ class="text-3xl sm:text-4xl font-black tracking-tight bg-transparent border-none outline-none focus:ring-0 flex-1 placeholder:text-muted-foreground/30 px-0 min-w-0" value={note().title} placeholder="Note Title" - readOnly={!canEdit} + readOnly={!canEdit()} onBlur={(e) => { const val = e.currentTarget.value.trim() || 'Untitled'; if (val !== note().title) handleRenameNote(note().id, note().title, val); }} />
- +