mirror of
https://github.com/zadam/trilium.git
synced 2025-12-13 03:39:54 +01:00
feat(note_actions): hide code notes from new layout
This commit is contained in:
@@ -65,7 +65,13 @@ function NoteTypeWidget({ note }: { note?: FNote | null }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function NoteTypeDropdownContent({ currentNoteType, currentNoteMime, note, setModalShown }: { currentNoteType?: NoteType, currentNoteMime?: string | null, note?: FNote | null, setModalShown: Dispatch<StateUpdater<boolean>> }) {
|
||||
export function NoteTypeDropdownContent({ currentNoteType, currentNoteMime, note, setModalShown, noCodeNotes }: {
|
||||
currentNoteType?: NoteType;
|
||||
currentNoteMime?: string | null;
|
||||
note?: FNote | null;
|
||||
setModalShown: Dispatch<StateUpdater<boolean>>;
|
||||
noCodeNotes?: boolean;
|
||||
}) {
|
||||
const mimeTypes = useMimeTypes();
|
||||
const noteTypes = useMemo(() => NOTE_TYPES.filter((nt) => !nt.reserved && !nt.static), []);
|
||||
const changeNoteType = useCallback(async (type: NoteType, mime?: string) => {
|
||||
@@ -103,7 +109,7 @@ export function NoteTypeDropdownContent({ currentNoteType, currentNoteMime, note
|
||||
}
|
||||
|
||||
const checked = (type === currentNoteType);
|
||||
if (type !== "code") {
|
||||
if (noCodeNotes || type !== "code") {
|
||||
return (
|
||||
<FormListItem
|
||||
checked={checked}
|
||||
@@ -126,7 +132,7 @@ export function NoteTypeDropdownContent({ currentNoteType, currentNoteMime, note
|
||||
}
|
||||
})}
|
||||
|
||||
<NoteTypeCodeNoteList mimeTypes={mimeTypes} changeNoteType={changeNoteType} setModalShown={setModalShown} />
|
||||
{!noCodeNotes && <NoteTypeCodeNoteList mimeTypes={mimeTypes} changeNoteType={changeNoteType} setModalShown={setModalShown} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -184,11 +184,16 @@ function EditabilityDropdown({ note }: { note: FNote }) {
|
||||
function NoteTypeDropdown({ note }: { note: FNote }) {
|
||||
const currentNoteType = useNoteProperty(note, "type") ?? undefined;
|
||||
const currentNoteMime = useNoteProperty(note, "mime");
|
||||
const [ modalShown, setModalShown ] = useState(false);
|
||||
|
||||
return (
|
||||
<FormDropdownSubmenu title={t("basic_properties.note_type")} icon="bx bx-file" dropStart>
|
||||
<NoteTypeDropdownContent currentNoteType={currentNoteType} currentNoteMime={currentNoteMime} note={note} setModalShown={setModalShown} />
|
||||
<NoteTypeDropdownContent
|
||||
currentNoteType={currentNoteType}
|
||||
currentNoteMime={currentNoteMime}
|
||||
note={note}
|
||||
setModalShown={() => { /* no-op since no code notes are displayed here */ }}
|
||||
noCodeNotes
|
||||
/>
|
||||
</FormDropdownSubmenu>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user