mirror of
https://github.com/zadam/trilium.git
synced 2025-12-12 18:34:24 +01:00
feat(note_actions): integrate editability menu into new layout
This commit is contained in:
parent
9262f94190
commit
cfbd2bf53a
@ -30,7 +30,7 @@ export default function BasicPropertiesTab({ note }: TabContext) {
|
||||
<div className="basic-properties-widget">
|
||||
<NoteTypeWidget note={note} />
|
||||
<ProtectedNoteSwitch note={note} />
|
||||
<EditabilitySelect note={note} />
|
||||
{!isNewLayout && <EditabilitySelect note={note} />}
|
||||
{!isNewLayout && <BookmarkSwitch note={note} />}
|
||||
{!isNewLayout && <SharedSwitch note={note} />}
|
||||
{!isNewLayout && <TemplateSwitch note={note} />}
|
||||
@ -190,7 +190,7 @@ function EditabilitySelect({ note }: { note?: FNote | null }) {
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function BookmarkSwitch({ note }: { note?: FNote | null }) {
|
||||
|
||||
@ -125,9 +125,28 @@ function NoteBasicProperties({ note }: { note: FNote }) {
|
||||
<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} />
|
||||
<EditabilityDropdown note={note} />
|
||||
</>;
|
||||
}
|
||||
|
||||
function EditabilityDropdown({ note }: { note: FNote }) {
|
||||
const [ readOnly, setReadOnly ] = useNoteLabelBoolean(note, "readOnly");
|
||||
const [ autoReadOnlyDisabled, setAutoReadOnlyDisabled ] = useNoteLabelBoolean(note, "autoReadOnlyDisabled");
|
||||
|
||||
function setState(readOnly: boolean, autoReadOnlyDisabled: boolean) {
|
||||
setReadOnly(readOnly);
|
||||
setAutoReadOnlyDisabled(autoReadOnlyDisabled);
|
||||
}
|
||||
|
||||
return (
|
||||
<FormDropdownSubmenu title={t("basic_properties.editable")} icon="bx bx-lock-alt" dropStart>
|
||||
<FormListItem checked={!readOnly && !autoReadOnlyDisabled} onClick={() => setState(false, false)} description={t("editability_select.note_is_editable")}>{t("editability_select.auto")}</FormListItem>
|
||||
<FormListItem checked={readOnly && !autoReadOnlyDisabled} onClick={() => setState(true, false)} description={t("editability_select.note_is_read_only")}>{t("editability_select.read_only")}</FormListItem>
|
||||
<FormListItem checked={!readOnly && autoReadOnlyDisabled} onClick={() => setState(false, true)} description={t("editability_select.note_is_always_editable")}>{t("editability_select.always_editable")}</FormListItem>
|
||||
</FormDropdownSubmenu>
|
||||
);
|
||||
}
|
||||
|
||||
function DevelopmentActions({ note, noteContext }: { note: FNote, noteContext?: NoteContext }) {
|
||||
return (
|
||||
<FormDropdownSubmenu title="Development Actions" icon="bx bx-wrench" dropStart>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user