mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(editor): Override selected nodes on single click without Meta/Ctrl key (#12549)
This commit is contained in:
@@ -6,7 +6,13 @@ import type {
|
||||
CanvasEventBusEvents,
|
||||
ConnectStartEvent,
|
||||
} from '@/types';
|
||||
import type { Connection, XYPosition, NodeDragEvent, GraphNode } from '@vue-flow/core';
|
||||
import type {
|
||||
Connection,
|
||||
XYPosition,
|
||||
NodeDragEvent,
|
||||
NodeMouseEvent,
|
||||
GraphNode,
|
||||
} from '@vue-flow/core';
|
||||
import { useVueFlow, VueFlow, PanelPosition, MarkerType } from '@vue-flow/core';
|
||||
import { MiniMap } from '@vue-flow/minimap';
|
||||
import Node from './elements/nodes/CanvasNode.vue';
|
||||
@@ -272,6 +278,14 @@ function onNodeDragStop(event: NodeDragEvent) {
|
||||
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
|
||||
}
|
||||
|
||||
function onNodeClick({ event, node }: NodeMouseEvent) {
|
||||
if (event.ctrlKey || event.metaKey || selectedNodes.value.length < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
onSelectNodes({ ids: [node.id] });
|
||||
}
|
||||
|
||||
function onSelectionDragStop(event: NodeDragEvent) {
|
||||
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
|
||||
}
|
||||
@@ -676,6 +690,7 @@ provide(CanvasKey, {
|
||||
@move-start="onPaneMoveStart"
|
||||
@move-end="onPaneMoveEnd"
|
||||
@node-drag-stop="onNodeDragStop"
|
||||
@node-click="onNodeClick"
|
||||
@selection-drag-stop="onSelectionDragStop"
|
||||
@dragover="onDragOver"
|
||||
@drop="onDrop"
|
||||
|
||||
Reference in New Issue
Block a user