diff --git a/src/renderer/src/components/ui/context-menu/context-menu.tsx b/src/renderer/src/components/ui/context-menu/context-menu.tsx index 1a7f5a2044..7133d3ca21 100644 --- a/src/renderer/src/components/ui/context-menu/context-menu.tsx +++ b/src/renderer/src/components/ui/context-menu/context-menu.tsx @@ -31,7 +31,7 @@ const ContextMenuSubTrigger = React.forwardRef< {...props} > {children} - + )) ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName diff --git a/src/renderer/src/providers/context-menu-provider.tsx b/src/renderer/src/providers/context-menu-provider.tsx index 597d54ca27..97dede3dc1 100644 --- a/src/renderer/src/providers/context-menu-provider.tsx +++ b/src/renderer/src/providers/context-menu-provider.tsx @@ -2,6 +2,7 @@ import { ContextMenu, ContextMenuContent, ContextMenuItem, + ContextMenuPortal, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, @@ -16,6 +17,7 @@ import type { NativeMenuItem } from "@renderer/lib/native-menu" import { CONTEXT_MENU_SHOW_EVENT_KEY } from "@renderer/lib/native-menu" import type { ReactNode } from "react" import { + Fragment, memo, useCallback, useEffect, @@ -126,15 +128,17 @@ const Item = memo(({ item }: { item: NativeMenuItem }) => { } case "text": { const Wrapper = item.submenu ? ContextMenuSubTrigger : ContextMenuItem + + const Sub = item.submenu ? ContextMenuSub : Fragment return ( - + - {/* {!!item.icon && {item.icon}} */} {item.icon} {item.label} @@ -143,16 +147,17 @@ const Item = memo(({ item }: { item: NativeMenuItem }) => { {item.shortcut} )} - - {item.submenu && ( + + {item.submenu && ( + {item.submenu.map((subItem, index) => ( ))} - )} - - + + )} + ) } default: {