mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +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,
|
CanvasEventBusEvents,
|
||||||
ConnectStartEvent,
|
ConnectStartEvent,
|
||||||
} from '@/types';
|
} 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 { useVueFlow, VueFlow, PanelPosition, MarkerType } from '@vue-flow/core';
|
||||||
import { MiniMap } from '@vue-flow/minimap';
|
import { MiniMap } from '@vue-flow/minimap';
|
||||||
import Node from './elements/nodes/CanvasNode.vue';
|
import Node from './elements/nodes/CanvasNode.vue';
|
||||||
@@ -272,6 +278,14 @@ function onNodeDragStop(event: NodeDragEvent) {
|
|||||||
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
|
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) {
|
function onSelectionDragStop(event: NodeDragEvent) {
|
||||||
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
|
onUpdateNodesPosition(event.nodes.map(({ id, position }) => ({ id, position })));
|
||||||
}
|
}
|
||||||
@@ -676,6 +690,7 @@ provide(CanvasKey, {
|
|||||||
@move-start="onPaneMoveStart"
|
@move-start="onPaneMoveStart"
|
||||||
@move-end="onPaneMoveEnd"
|
@move-end="onPaneMoveEnd"
|
||||||
@node-drag-stop="onNodeDragStop"
|
@node-drag-stop="onNodeDragStop"
|
||||||
|
@node-click="onNodeClick"
|
||||||
@selection-drag-stop="onSelectionDragStop"
|
@selection-drag-stop="onSelectionDragStop"
|
||||||
@dragover="onDragOver"
|
@dragover="onDragOver"
|
||||||
@drop="onDrop"
|
@drop="onDrop"
|
||||||
|
|||||||
Reference in New Issue
Block a user