Skip to content

Build your personal knowledge base with Trilium Notes

chore(note_actions): reintroduce disabled logic for toggles

Elian Doranefb2f9a048ab
diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsx
index 92c021c559..8be2836053 100644
--- a/apps/client/src/widgets/react/FormList.tsx
+++ b/apps/client/src/widgets/react/FormList.tsx
@@ -141,7 +141,9 @@ export function FormListToggleableItem({ title, currentValue, onChange, ...props
return (
<FormListItem {...props} onClick={(e) => {
e.stopPropagation();
- onChange(!currentValue);
+ if (!props.disabled) {
+ onChange(!currentValue);
+ }
}}>
<FormToggle
switchOnName={title} switchOffName={title}
diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx
index 22e913b16d..d4b5e235a1 100644
--- a/apps/client/src/widgets/ribbon/NoteActions.tsx
+++ b/apps/client/src/widgets/ribbon/NoteActions.tsx
@@ -122,9 +122,24 @@ function NoteBasicProperties({ note }: { note: FNote }) {
const [ isTemplate, setIsTemplate ] = useNoteLabelBoolean(note, "template");
return <>
- <FormListToggleableItem icon="bx bx-bookmark" title={t("bookmark_switch.bookmark")} currentValue={isBookmarked} onChange={setIsBookmarked} />
- <FormListToggleableItem icon="bx bx-share-alt" title={t("shared_switch.shared")} currentValue={isShared} onChange={switchShareState} />
- <FormListToggleableItem icon="bx bx-copy-alt" title={t("template_switch.template")} currentValue={isTemplate} onChange={setIsTemplate} />
+ <FormListToggleableItem
+ icon="bx bx-bookmark"
+ title={t("bookmark_switch.bookmark")}
+ currentValue={isBookmarked} onChange={setIsBookmarked}
+ disabled={["root", "_hidden"].includes(note?.noteId ?? "")}
+ />
+ <FormListToggleableItem
+ icon="bx bx-copy-alt"
+ title={t("template_switch.template")}
+ currentValue={isTemplate} onChange={setIsTemplate}
+ disabled={note?.noteId.startsWith("_options")}
+ />
+ <FormListToggleableItem
+ icon="bx bx-share-alt"
+ title={t("shared_switch.shared")}
+ currentValue={isShared} onChange={switchShareState}
+ disabled={["root", "_share", "_hidden"].includes(note?.noteId ?? "") || note?.noteId.startsWith("_options")}
+ />
<EditabilityDropdown note={note} />
</>;
}