This commit is contained in:
2026-02-27 17:44:57 -06:00
parent f9de2cfd2b
commit 18401dd07c
2 changed files with 7 additions and 15 deletions
-8
View File
@@ -117,14 +117,6 @@ export const TaskEditor: Component<TaskEditorProps> = (props) => {
}
});
// Make editor react to editable changes
createEffect(() => {
const e = editor();
if (e && props.editable !== undefined) {
e.setEditable(props.editable);
}
});
return (
<>
<div
+7 -7
View File
@@ -18,7 +18,7 @@ export const NotepadView: Component<{
const [isLinking, setIsLinking] = createSignal(false);
const [linkSearchQuery, setLinkSearchQuery] = createSignal("");
const currentUserId = () => pb.authStore.model?.id;
const currentUserId = pb.authStore.model?.id;
// Derived states
const activeNote = createMemo(() => {
@@ -159,8 +159,8 @@ export const NotepadView: Component<{
</div>
}>
{(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);
}}
/>
<div class="flex items-center gap-2 shrink-0 pt-1">
<Show when={isOwner()}>
<Show when={isOwner}>
<Button
variant="ghost"
size="sm"
@@ -200,7 +200,7 @@ export const NotepadView: Component<{
</Button>
</Show>
<Show when={isOwner()}>
<Show when={isOwner}>
<Button
variant="ghost"
size="icon"
@@ -220,7 +220,7 @@ export const NotepadView: Component<{
<TaskEditor
content={note().content}
onUpdate={(html) => handleUpdateContent(note().id, html)}
editable={canEdit()}
editable={canEdit}
/>
</div>
</div>