mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Remove unneeded onClickOutside handler from context menu (no-changelog) (#13848)
This commit is contained in:
@@ -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`,
|
||||
|
||||
Reference in New Issue
Block a user