mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +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 (
|
return (
|
||||||
<>{ children }</>
|
<>{ children }</>
|
||||||
);
|
);
|
||||||
@ -53,6 +53,9 @@ export function ContextMenu({ children, menus, pluginContext }: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ContextMenu.create = (pluginContext: IPublicModelPluginContext, menus: IPublicTypeContextMenuAction[], event: MouseEvent) => {
|
ContextMenu.create = (pluginContext: IPublicModelPluginContext, menus: IPublicTypeContextMenuAction[], event: MouseEvent) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
const children: React.ReactNode[] = parseContextMenuAsReactNode(parseContextMenuProperties(menus, {
|
const children: React.ReactNode[] = parseContextMenuAsReactNode(parseContextMenuProperties(menus, {
|
||||||
pluginContext,
|
pluginContext,
|
||||||
}), {
|
}), {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user