From 1a9fb34a6e946ef4acd023c7d2bdba2ba7f1df7f Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 11 Dec 2025 19:37:04 +0200 Subject: [PATCH] feat(note_bars/collection): support dropdown menu click action --- .../src/widgets/note_bars/CollectionProperties.tsx | 10 +++++++++- apps/client/src/widgets/react/FormList.tsx | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.tsx b/apps/client/src/widgets/note_bars/CollectionProperties.tsx index 830ef67c2..bee74b513 100644 --- a/apps/client/src/widgets/note_bars/CollectionProperties.tsx +++ b/apps/client/src/widgets/note_bars/CollectionProperties.tsx @@ -106,9 +106,17 @@ function ButtonPropertyView({ note, property }: { note: FNote, property: ButtonP function SplitButtonPropertyView({ note, property }: { note: FNote, property: SplitButtonProperty }) { const parentComponent = useContext(ParentComponent); const ItemsComponent = property.items; + const clickContext = parentComponent && { + note, + triggerCommand: parentComponent.triggerCommand.bind(parentComponent) + }; return (parentComponent && - + clickContext && property.onClick(clickContext)} + > ); diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsx index dd5948cb3..42f43a044 100644 --- a/apps/client/src/widgets/react/FormList.tsx +++ b/apps/client/src/widgets/react/FormList.tsx @@ -206,10 +206,11 @@ export function FormDropdownDivider() { return
; } -export function FormDropdownSubmenu({ icon, title, children, dropStart }: { +export function FormDropdownSubmenu({ icon, title, children, dropStart, onDropdownToggleClicked }: { icon: string, title: ComponentChildren, children: ComponentChildren, + onDropdownToggleClicked?: () => void, dropStart?: boolean }) { const [ openOnMobile, setOpenOnMobile ] = useState(false); @@ -224,6 +225,10 @@ export function FormDropdownSubmenu({ icon, title, children, dropStart }: { if (isMobile()) { setOpenOnMobile(!openOnMobile); } + + if (onDropdownToggleClicked) { + onDropdownToggleClicked(); + } }} > {" "}