mirror of
https://github.com/zadam/trilium.git
synced 2025-12-12 18:34:24 +01:00
chore(note_actions): reintroduce disabled logic for toggles
This commit is contained in:
parent
01978dabf0
commit
efb2f9a048
@ -141,7 +141,9 @@ export function FormListToggleableItem({ title, currentValue, onChange, ...props
|
|||||||
return (
|
return (
|
||||||
<FormListItem {...props} onClick={(e) => {
|
<FormListItem {...props} onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
onChange(!currentValue);
|
if (!props.disabled) {
|
||||||
|
onChange(!currentValue);
|
||||||
|
}
|
||||||
}}>
|
}}>
|
||||||
<FormToggle
|
<FormToggle
|
||||||
switchOnName={title} switchOffName={title}
|
switchOnName={title} switchOffName={title}
|
||||||
|
|||||||
@ -122,9 +122,24 @@ function NoteBasicProperties({ note }: { note: FNote }) {
|
|||||||
const [ isTemplate, setIsTemplate ] = useNoteLabelBoolean(note, "template");
|
const [ isTemplate, setIsTemplate ] = useNoteLabelBoolean(note, "template");
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<FormListToggleableItem icon="bx bx-bookmark" title={t("bookmark_switch.bookmark")} currentValue={isBookmarked} onChange={setIsBookmarked} />
|
<FormListToggleableItem
|
||||||
<FormListToggleableItem icon="bx bx-share-alt" title={t("shared_switch.shared")} currentValue={isShared} onChange={switchShareState} />
|
icon="bx bx-bookmark"
|
||||||
<FormListToggleableItem icon="bx bx-copy-alt" title={t("template_switch.template")} currentValue={isTemplate} onChange={setIsTemplate} />
|
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} />
|
<EditabilityDropdown note={note} />
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user