mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 17:14:05 -08:00
9c94050deb
* refactor: replace Vue.extend with defineComponent in editor-ui * fix: change $externalHooks extractions from mixins * fix: refactor externalHooks mixin
32 lines
823 B
TypeScript
32 lines
823 B
TypeScript
import { defineComponent } from 'vue';
|
|
|
|
export const deviceSupportHelpers = defineComponent({
|
|
data() {
|
|
return {
|
|
// @ts-ignore msMaxTouchPoints is deprecated but must fix tablet bugs before fixing this.. otherwise breaks touchscreen computers
|
|
isTouchDevice: 'ontouchstart' in window || navigator.msMaxTouchPoints,
|
|
isMacOs: /(ipad|iphone|ipod|mac)/i.test(navigator.platform), // TODO: `platform` deprecated
|
|
};
|
|
},
|
|
computed: {
|
|
// TODO: Check if used anywhere
|
|
controlKeyCode(): string {
|
|
if (this.isMacOs) {
|
|
return 'Meta';
|
|
}
|
|
return 'Control';
|
|
},
|
|
},
|
|
methods: {
|
|
isCtrlKeyPressed(e: MouseEvent | KeyboardEvent): boolean {
|
|
if (this.isTouchDevice === true && e instanceof MouseEvent) {
|
|
return true;
|
|
}
|
|
if (this.isMacOs) {
|
|
return e.metaKey;
|
|
}
|
|
return e.ctrlKey;
|
|
},
|
|
},
|
|
});
|