fix(editor): Remove unneeded onClickOutside handler from context menu (no-changelog) (#13848)

This commit is contained in:
Elias Meire
2025-03-12 11:36:44 +01:00
committed by GitHub
parent e73f618851
commit 9057ee69df

View File

@@ -2,13 +2,11 @@
import { type ContextMenuAction, useContextMenu } from '@/composables/useContextMenu';
import { N8nActionDropdown } from '@n8n/design-system';
import { watch, ref } from 'vue';
import { onClickOutside } from '@vueuse/core';
const contextMenu = useContextMenu();
const { position, isOpen, actions, target } = contextMenu;
const dropdown = ref<InstanceType<typeof N8nActionDropdown>>();
const emit = defineEmits<{ action: [action: ContextMenuAction, nodeIds: string[]] }>();
const container = ref<HTMLDivElement>();
watch(
isOpen,
@@ -28,27 +26,16 @@ function onActionSelect(item: string) {
emit('action', action, contextMenu.targetNodeIds.value);
}
function closeMenu(event: MouseEvent) {
if (event.cancelable) {
event.preventDefault();
}
event.stopPropagation();
contextMenu.close();
}
function onVisibleChange(open: boolean) {
if (!open) {
contextMenu.close();
}
}
onClickOutside(container, closeMenu);
</script>
<template>
<Teleport v-if="isOpen" to="body">
<div
ref="container"
:class="$style.contextMenu"
:style="{
left: `${position[0]}px`,