mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-10 18:03:01 +00:00
feat(context-menu): prevent event bubbling when "menus" is empty
This commit is contained in:
parent
e3a19896d7
commit
ed7befbff0
@ -34,7 +34,7 @@ export function ContextMenu({ children, menus, pluginContext }: {
|
||||
);
|
||||
}
|
||||
|
||||
if (!menus || !menus.length) {
|
||||
if (!menus) {
|
||||
return (
|
||||
<>{ children }</>
|
||||
);
|
||||
@ -53,6 +53,9 @@ export function ContextMenu({ children, menus, pluginContext }: {
|
||||
}
|
||||
|
||||
ContextMenu.create = (pluginContext: IPublicModelPluginContext, menus: IPublicTypeContextMenuAction[], event: MouseEvent) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
const children: React.ReactNode[] = parseContextMenuAsReactNode(parseContextMenuProperties(menus, {
|
||||
pluginContext,
|
||||
}), {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user