feat(note_actions): integrate editability menu into new layout

This commit is contained in:
Elian Doran 2025-12-10 18:58:46 +02:00
parent 9262f94190
commit cfbd2bf53a
No known key found for this signature in database
2 changed files with 21 additions and 2 deletions

View File

@ -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 }) {

View File

@ -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>