mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-12 15:44:06 -08:00
🐛 Fix issue that it starts select mode when mac users try to move workflow
This commit is contained in:
parent
85d9cc4eb8
commit
40b17c59f6
|
@ -11,6 +11,11 @@ export const mouseSelect = mixins(nodeIndex).extend({
|
||||||
selectBox: document.createElement('span'),
|
selectBox: document.createElement('span'),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
isMacOs (): boolean {
|
||||||
|
return /(ipad|iphone|ipod|mac)/i.test(navigator.platform);
|
||||||
|
},
|
||||||
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.createSelectBox();
|
this.createSelectBox();
|
||||||
},
|
},
|
||||||
|
@ -28,6 +33,12 @@ export const mouseSelect = mixins(nodeIndex).extend({
|
||||||
// document.body.appendChild(this.selectBox);
|
// document.body.appendChild(this.selectBox);
|
||||||
this.$el.appendChild(this.selectBox);
|
this.$el.appendChild(this.selectBox);
|
||||||
},
|
},
|
||||||
|
isCtrlKeyPressed (e: MouseEvent | KeyboardEvent): boolean {
|
||||||
|
if (this.isMacOs) {
|
||||||
|
return e.metaKey;
|
||||||
|
}
|
||||||
|
return e.ctrlKey;
|
||||||
|
},
|
||||||
showSelectBox (event: MouseEvent) {
|
showSelectBox (event: MouseEvent) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.selectBox.x = event.pageX;
|
this.selectBox.x = event.pageX;
|
||||||
|
@ -97,7 +108,7 @@ export const mouseSelect = mixins(nodeIndex).extend({
|
||||||
return returnNodes;
|
return returnNodes;
|
||||||
},
|
},
|
||||||
mouseDownMouseSelect (e: MouseEvent) {
|
mouseDownMouseSelect (e: MouseEvent) {
|
||||||
if (e.ctrlKey === true) {
|
if (this.isCtrlKeyPressed(e) === true) {
|
||||||
// We only care about it when the ctrl key is not pressed at the same time.
|
// We only care about it when the ctrl key is not pressed at the same time.
|
||||||
// So we exit when it is pressed.
|
// So we exit when it is pressed.
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue