diff --git a/packages/editor-ui/src/components/ContextMenu/ContextMenu.vue b/packages/editor-ui/src/components/ContextMenu/ContextMenu.vue index c6b195f136183..1113468ffe7ac 100644 --- a/packages/editor-ui/src/components/ContextMenu/ContextMenu.vue +++ b/packages/editor-ui/src/components/ContextMenu/ContextMenu.vue @@ -4,38 +4,47 @@ import { N8nActionDropdown } from 'n8n-design-system'; import type { INode } from 'n8n-workflow'; import { watch, ref } from 'vue'; -const { isOpen, actions, position, targetNodes, target, close } = useContextMenu(); -const contextMenu = ref>(); +const contextMenu = useContextMenu(); +const { position, isOpen, actions, target } = contextMenu; +const dropdown = ref>(); const emit = defineEmits<{ (event: 'action', action: ContextMenuAction, nodes: INode[]): void }>(); watch( isOpen, () => { if (isOpen) { - contextMenu.value?.open(); + dropdown.value?.open(); } else { - contextMenu.value?.close(); + dropdown.value?.close(); } }, { flush: 'post' }, ); function onActionSelect(item: string) { - emit('action', item as ContextMenuAction, targetNodes.value); + const action = item as ContextMenuAction; + contextMenu._dispatchAction(action); + emit('action', action, contextMenu.targetNodes.value); } function onVisibleChange(open: boolean) { if (!open) { - close(); + contextMenu.close(); } }