mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -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'),
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isMacOs (): boolean {
|
||||
return /(ipad|iphone|ipod|mac)/i.test(navigator.platform);
|
||||
},
|
||||
},
|
||||
mounted () {
|
||||
this.createSelectBox();
|
||||
},
|
||||
|
@ -28,6 +33,12 @@ export const mouseSelect = mixins(nodeIndex).extend({
|
|||
// document.body.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) {
|
||||
// @ts-ignore
|
||||
this.selectBox.x = event.pageX;
|
||||
|
@ -97,7 +108,7 @@ export const mouseSelect = mixins(nodeIndex).extend({
|
|||
return returnNodes;
|
||||
},
|
||||
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.
|
||||
// So we exit when it is pressed.
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue