mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +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 { type ContextMenuAction, useContextMenu } from '@/composables/useContextMenu';
|
||||||
import { N8nActionDropdown } from '@n8n/design-system';
|
import { N8nActionDropdown } from '@n8n/design-system';
|
||||||
import { watch, ref } from 'vue';
|
import { watch, ref } from 'vue';
|
||||||
import { onClickOutside } from '@vueuse/core';
|
|
||||||
|
|
||||||
const contextMenu = useContextMenu();
|
const contextMenu = useContextMenu();
|
||||||
const { position, isOpen, actions, target } = contextMenu;
|
const { position, isOpen, actions, target } = contextMenu;
|
||||||
const dropdown = ref<InstanceType<typeof N8nActionDropdown>>();
|
const dropdown = ref<InstanceType<typeof N8nActionDropdown>>();
|
||||||
const emit = defineEmits<{ action: [action: ContextMenuAction, nodeIds: string[]] }>();
|
const emit = defineEmits<{ action: [action: ContextMenuAction, nodeIds: string[]] }>();
|
||||||
const container = ref<HTMLDivElement>();
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
isOpen,
|
isOpen,
|
||||||
@@ -28,27 +26,16 @@ function onActionSelect(item: string) {
|
|||||||
emit('action', action, contextMenu.targetNodeIds.value);
|
emit('action', action, contextMenu.targetNodeIds.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeMenu(event: MouseEvent) {
|
|
||||||
if (event.cancelable) {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
event.stopPropagation();
|
|
||||||
contextMenu.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onVisibleChange(open: boolean) {
|
function onVisibleChange(open: boolean) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
contextMenu.close();
|
contextMenu.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickOutside(container, closeMenu);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Teleport v-if="isOpen" to="body">
|
<Teleport v-if="isOpen" to="body">
|
||||||
<div
|
<div
|
||||||
ref="container"
|
|
||||||
:class="$style.contextMenu"
|
:class="$style.contextMenu"
|
||||||
:style="{
|
:style="{
|
||||||
left: `${position[0]}px`,
|
left: `${position[0]}px`,
|
||||||
|
|||||||
Reference in New Issue
Block a user