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 (
|
||||
<FormListItem {...props} onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (!props.disabled) {
|
||||
onChange(!currentValue);
|
||||
}
|
||||
}}>
|
||||
<FormToggle
|
||||
switchOnName={title} switchOffName={title}
|
||||
|
||||
@ -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} />
|
||||
</>;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user