mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-13 13:57:29 -08:00
⚡ Implement that nodes can also be deselected with ctrl+click
This commit is contained in:
parent
416eb81a6e
commit
5054c7054d
|
@ -156,6 +156,13 @@ export const mouseSelect = mixins(nodeIndex).extend({
|
||||||
this.updateSelectBox(e);
|
this.updateSelectBox(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
nodeDeselected (node: INodeUi) {
|
||||||
|
this.$store.commit('removeNodeFromSelection', node);
|
||||||
|
const nodeElement = `node-${this.getNodeIndex(node.name)}`;
|
||||||
|
// @ts-ignore
|
||||||
|
this.instance.removeFromDragSelection(nodeElement);
|
||||||
|
|
||||||
|
},
|
||||||
nodeSelected (node: INodeUi) {
|
nodeSelected (node: INodeUi) {
|
||||||
this.$store.commit('addSelectedNode', node);
|
this.$store.commit('addSelectedNode', node);
|
||||||
const nodeElement = `node-${this.getNodeIndex(node.name)}`;
|
const nodeElement = `node-${this.getNodeIndex(node.name)}`;
|
||||||
|
|
|
@ -26,6 +26,9 @@ export const nodeBase = mixins(nodeIndex).extend({
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
isMacOs(): boolean {
|
||||||
|
return /(ipad|iphone|ipod|mac)/i.test(navigator.platform);
|
||||||
|
},
|
||||||
isReadOnly (): boolean {
|
isReadOnly (): boolean {
|
||||||
if (['NodeViewExisting', 'NodeViewNew'].includes(this.$route.name as string)) {
|
if (['NodeViewExisting', 'NodeViewNew'].includes(this.$route.name as string)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -271,24 +274,33 @@ export const nodeBase = mixins(nodeIndex).extend({
|
||||||
|
|
||||||
this.$store.commit('updateNodeProperties', updateInformation);
|
this.$store.commit('updateNodeProperties', updateInformation);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$store.commit('removeActiveAction', 'dragActive');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filter: '.action-button',
|
filter: '.action-button',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isCtrlKeyPressed(e: MouseEvent | KeyboardEvent): boolean {
|
||||||
|
if (this.isMacOs) {
|
||||||
|
return e.metaKey;
|
||||||
|
}
|
||||||
|
return e.ctrlKey;
|
||||||
|
},
|
||||||
|
|
||||||
mouseLeftClick (e: MouseEvent) {
|
mouseLeftClick (e: MouseEvent) {
|
||||||
if (this.$store.getters.isActionActive('dragActive')) {
|
if (this.$store.getters.isActionActive('dragActive')) {
|
||||||
this.$store.commit('removeActiveAction', 'dragActive');
|
this.$store.commit('removeActiveAction', 'dragActive');
|
||||||
} else {
|
} else {
|
||||||
if (!e.ctrlKey) {
|
if (this.isCtrlKeyPressed(e) === false) {
|
||||||
this.$emit('deselectAllNodes');
|
this.$emit('deselectAllNodes');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.$store.getters.isNodeSelected(this.data.name)) {
|
||||||
|
this.$emit('deselectNode', this.name);
|
||||||
|
} else {
|
||||||
this.$emit('nodeSelected', this.name);
|
this.$emit('nodeSelected', this.name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
v-for="nodeData in nodes"
|
v-for="nodeData in nodes"
|
||||||
@duplicateNode="duplicateNode"
|
@duplicateNode="duplicateNode"
|
||||||
@deselectAllNodes="deselectAllNodes"
|
@deselectAllNodes="deselectAllNodes"
|
||||||
|
@deselectNode="nodeDeselectedByName"
|
||||||
@nodeSelected="nodeSelectedByName"
|
@nodeSelected="nodeSelectedByName"
|
||||||
@removeNode="removeNode"
|
@removeNode="removeNode"
|
||||||
@runWorkflow="runWorkflow"
|
@runWorkflow="runWorkflow"
|
||||||
|
@ -781,6 +782,13 @@ export default mixins(
|
||||||
this.createNodeActive = false;
|
this.createNodeActive = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
nodeDeselectedByName (nodeName: string) {
|
||||||
|
const node = this.$store.getters.nodeByName(nodeName);
|
||||||
|
if (node) {
|
||||||
|
this.nodeDeselected(node);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
nodeSelectedByName (nodeName: string, setActive = false, deselectAllOthers?: boolean) {
|
nodeSelectedByName (nodeName: string, setActive = false, deselectAllOthers?: boolean) {
|
||||||
if (deselectAllOthers === true) {
|
if (deselectAllOthers === true) {
|
||||||
this.deselectAllNodes();
|
this.deselectAllNodes();
|
||||||
|
|
Loading…
Reference in a new issue