Skip to content

Build your personal knowledge base with Trilium Notes

refactor(menu): drop `dropStart`, which only the nested submenu read

Elian Doranaecba4f258c7
diff --git a/apps/client/src/widgets/buttons/global_menu.tsx b/apps/client/src/widgets/buttons/global_menu.tsx
index f2e4e05b30..29978fd07e 100644
--- a/apps/client/src/widgets/buttons/global_menu.tsx
+++ b/apps/client/src/widgets/buttons/global_menu.tsx
@@ -63,7 +63,7 @@ export default function GlobalMenu({ isHorizontalLayout }: { isHorizontalLayout:
<SwitchToOptions />
<MenuItem command="showLaunchBarSubtree" icon={`bx ${isMobile() ? "bx-mobile" : "bx-sidebar"}`} text={t("global_menu.configure_launchbar")} />
- <AdvancedMenu dropStart={!isVerticalLayout} />
+ <AdvancedMenu />
<MenuItem command="showOptions" icon="bx bx-cog" text={t("global_menu.options")} />
<FormDropdownDivider />
@@ -79,14 +79,14 @@ export default function GlobalMenu({ isHorizontalLayout }: { isHorizontalLayout:
</>}
{!isElectron() && !isStandalone && <BrowserOnlyOptions />}
- {glob.isDev && <DevelopmentOptions dropStart={!isVerticalLayout} />}
+ {glob.isDev && <DevelopmentOptions />}
</Dropdown>
);
}
-function AdvancedMenu({ dropStart }: { dropStart: boolean }) {
+function AdvancedMenu() {
return (
- <FormDropdownSubmenu icon="bx bx-chip" title={t("global_menu.advanced")} dropStart={dropStart}>
+ <FormDropdownSubmenu icon="bx bx-chip" title={t("global_menu.advanced")}>
<MenuItem command="showHiddenSubtree" icon="bx bx-hide" text={t("global_menu.show_hidden_subtree")} />
<MenuItem command="showSearchHistory" icon="bx bx-search-alt" text={t("global_menu.open_search_history")} />
<FormDropdownDivider />
@@ -109,10 +109,10 @@ function BrowserOnlyOptions() {
</>;
}
-function DevelopmentOptions({ dropStart }: { dropStart: boolean }) {
+function DevelopmentOptions() {
return <>
<FormListHeader text="Development Options" />
- <FormDropdownSubmenu icon="bx bx-test-tube" title="Experimental features" dropStart={dropStart}>
+ <FormDropdownSubmenu icon="bx bx-test-tube" title="Experimental features">
{getAvailableExperimentalFeatures().map((feature) => (
<ExperimentalFeatureToggle key={feature.id} experimentalFeature={feature as ExperimentalFeature} />
))}
diff --git a/apps/client/src/widgets/layout/ActiveContentBadges.tsx b/apps/client/src/widgets/layout/ActiveContentBadges.tsx
index 81ca47aadb..7ce70e9514 100644
--- a/apps/client/src/widgets/layout/ActiveContentBadges.tsx
+++ b/apps/client/src/widgets/layout/ActiveContentBadges.tsx
@@ -56,7 +56,6 @@ const typeMappings: Record<ActiveContentInfo["type"], {
bindToLabel: "run",
label: t("active_content_badges.menu_run"),
icon: "bx bx-rss",
- dropStart: true,
options: [
{ value: null, label: t("active_content_badges.menu_run_disabled") },
{ value: "backendStartup", label: t("active_content_badges.menu_run_backend_startup") },
@@ -86,7 +85,6 @@ const typeMappings: Record<ActiveContentInfo["type"], {
bindToLabel: "run",
label: t("active_content_badges.menu_run"),
icon: "bx bx-rss",
- dropStart: true,
options: [
{ value: null, label: t("active_content_badges.menu_run_disabled") },
{ value: "frontendStartup", label: t("active_content_badges.menu_run_frontend_startup") },
@@ -143,7 +141,6 @@ const typeMappings: Record<ActiveContentInfo["type"], {
bindToLabel: "appThemeBase",
label: t("active_content_badges.menu_theme_base"),
icon: "bx bx-layer",
- dropStart: true,
options: [
{ label: t("theme.auto_theme"), value: null },
{ type: "separator" },
diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsx
index 685d429a9c..c3e5288f8c 100644
--- a/apps/client/src/widgets/react/FormList.tsx
+++ b/apps/client/src/widgets/react/FormList.tsx
@@ -356,8 +356,6 @@ export interface FormDropdownSubmenuProps {
children: ComponentChildren;
/** Called when the row is clicked, or run from the keyboard, on the desktop. */
onDropdownToggleClicked?: (e: MouseEvent) => void;
- /** Opens the nested list towards the start. Inside a menu, its layer flips on its own. */
- dropStart?: boolean;
/** Inside a menu, lays the submenu's rows out in this many columns. */
columns?: number;
disabled?: boolean;
diff --git a/apps/client/src/widgets/react/NotePropertyMenu.tsx b/apps/client/src/widgets/react/NotePropertyMenu.tsx
index 7b31152deb..b72dfe53a2 100644
--- a/apps/client/src/widgets/react/NotePropertyMenu.tsx
+++ b/apps/client/src/widgets/react/NotePropertyMenu.tsx
@@ -83,7 +83,6 @@ export interface ComboBoxProperty {
*/
defaultValue?: string;
options: (ComboBoxItem | Separator | ComboBoxGroup)[];
- dropStart?: boolean;
}
export interface SubmenuProperty {
@@ -266,7 +265,6 @@ function ComboBoxPropertyView({ note, property }: { note: FNote, property: Combo
<FormDropdownSubmenu
title={<PropertyLabel property={property} />}
icon={property.icon ?? "bx bx-empty"}
- dropStart={property.dropStart}
>
{(property.options).map((option, index) => {
if ("items" in option) {
diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx
index 83eba36170..92ed156ff7 100644
--- a/apps/client/src/widgets/ribbon/NoteActions.tsx
+++ b/apps/client/src/widgets/ribbon/NoteActions.tsx
@@ -191,7 +191,7 @@ export function NoteContextMenu({ note, noteContext, itemsAtStart, itemsNearNote
{isBoard && <CommandItem icon="bx bx-cog" text={t("board_view.properties")}
command={() => parentComponent?.triggerEvent("showBoardProperties", { ntxId: noteContext?.ntxId })} />}
- <FormDropdownSubmenu icon="bx bx-wrench" title={t("note_actions.advanced")} dropStart>
+ <FormDropdownSubmenu icon="bx bx-wrench" title={t("note_actions.advanced")}>
<CommandItem command="openNoteExternally" icon="bx bx-file-find" disabled={isSearchOrBook || !isElectron} text={t("note_actions.open_note_externally")} title={t("note_actions.open_note_externally_title")} />
<CommandItem command="openNoteCustom" icon="bx bx-customize" disabled={isSearchOrBook || isMac || !isElectron} text={t("note_actions.open_note_custom")} />
<CommandItem command="showNoteSource" icon="bx bx-code" disabled={!hasSource} text={t("note_actions.note_source")} />
@@ -226,7 +226,7 @@ function CodeProperties({ note }: { note: FNote }) {
return (
<>
- <FormDropdownSubmenu title={t("note_actions.word_wrap")} icon="bx bx-align-justify" dropStart>
+ <FormDropdownSubmenu title={t("note_actions.word_wrap")} icon="bx bx-align-justify">
<FormListItem checked={wrapLines == null} onClick={() => setWrapLines(null)} description={t("note_actions.word_wrap_auto_description")}>
{t("note_actions.word_wrap_auto")}
</FormListItem>
@@ -312,7 +312,7 @@ function EditabilityDropdown({ note }: { note: FNote }) {
}
return (
- <FormDropdownSubmenu title={t("basic_properties.editable")} icon="bx bx-edit-alt" dropStart>
+ <FormDropdownSubmenu title={t("basic_properties.editable")} icon="bx bx-edit-alt">
<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>
@@ -325,7 +325,7 @@ function NoteTypeDropdown({ note }: { note: FNote }) {
const currentNoteMime = useNoteProperty(note, "mime");
return (
- <FormDropdownSubmenu title={t("basic_properties.note_type")} icon="bx bx-file" dropStart>
+ <FormDropdownSubmenu title={t("basic_properties.note_type")} icon="bx bx-file">
<NoteTypeDropdownContent
currentNoteType={currentNoteType}
currentNoteMime={currentNoteMime}
@@ -429,7 +429,6 @@ function ExportAsImage({ ntxId, parentComponent }: { ntxId: string | null | unde
<FormDropdownSubmenu
icon="bx bxs-file-image"
title={t("note_actions.export_as_image")}
- dropStart
>
<FormListItem
icon="bx bxs-file-png"
diff --git a/packages/commons/src/lib/script_api_preact.ts b/packages/commons/src/lib/script_api_preact.ts
index bc6a4a74d3..bde4f9c9c0 100644
--- a/packages/commons/src/lib/script_api_preact.ts
+++ b/packages/commons/src/lib/script_api_preact.ts
@@ -243,8 +243,8 @@ interface FormDropdownSubmenuProps {
title: ComponentChildren;
children?: ComponentChildren;
onDropdownToggleClicked?: () => void;
- dropStart?: boolean;
}
+/** A row that opens its children as a submenu. Outside a `Dropdown` menu, its title heads them. */
export declare const FormDropdownSubmenu: FunctionComponent<FormDropdownSubmenuProps>;
interface FormRadioGroupProps {