mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(editor): Migrate deviceSupportHelpers mixin to useDeviceSupport composable (no-changelog) (#8289)
This commit is contained in:
@@ -377,6 +377,7 @@ import { useExternalHooks } from '@/composables/useExternalHooks';
|
||||
import { useClipboard } from '@/composables/useClipboard';
|
||||
import { usePinnedData } from '@/composables/usePinnedData';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
import { useDeviceSupport } from 'n8n-design-system';
|
||||
import { useDebounce } from '@/composables/useDebounce';
|
||||
|
||||
interface AddNodeOptions {
|
||||
@@ -476,6 +477,7 @@ export default defineComponent({
|
||||
const clipboard = useClipboard();
|
||||
const { activeNode } = storeToRefs(ndvStore);
|
||||
const pinnedData = usePinnedData(activeNode);
|
||||
const deviceSupport = useDeviceSupport();
|
||||
const { callDebounced } = useDebounce();
|
||||
|
||||
return {
|
||||
@@ -486,6 +488,7 @@ export default defineComponent({
|
||||
externalHooks,
|
||||
clipboard,
|
||||
pinnedData,
|
||||
deviceSupport,
|
||||
callDebounced,
|
||||
...useCanvasMouseSelect(),
|
||||
...useGlobalLinkActions(),
|
||||
@@ -1378,7 +1381,7 @@ export default defineComponent({
|
||||
this.collaborationStore.notifyWorkflowOpened(workflow.id);
|
||||
},
|
||||
touchTap(e: MouseEvent | TouchEvent) {
|
||||
if (this.isTouchDevice) {
|
||||
if (this.deviceSupport.isTouchDevice) {
|
||||
this.mouseDown(e);
|
||||
}
|
||||
},
|
||||
@@ -1403,7 +1406,7 @@ export default defineComponent({
|
||||
this.mouseUpMoveWorkflow(e);
|
||||
},
|
||||
keyUp(e: KeyboardEvent) {
|
||||
if (e.key === this.controlKeyCode) {
|
||||
if (e.key === this.deviceSupport.controlKeyCode) {
|
||||
this.ctrlKeyPressed = false;
|
||||
}
|
||||
if (e.key === ' ') {
|
||||
@@ -1413,10 +1416,10 @@ export default defineComponent({
|
||||
async keyDown(e: KeyboardEvent) {
|
||||
this.contextMenu.close();
|
||||
|
||||
const ctrlModifier = this.isCtrlKeyPressed(e) && !e.shiftKey && !e.altKey;
|
||||
const shiftModifier = e.shiftKey && !e.altKey && !this.isCtrlKeyPressed(e);
|
||||
const ctrlAltModifier = this.isCtrlKeyPressed(e) && e.altKey && !e.shiftKey;
|
||||
const noModifierKeys = !this.isCtrlKeyPressed(e) && !e.shiftKey && !e.altKey;
|
||||
const ctrlModifier = this.deviceSupport.isCtrlKeyPressed(e) && !e.shiftKey && !e.altKey;
|
||||
const shiftModifier = e.shiftKey && !e.altKey && !this.deviceSupport.isCtrlKeyPressed(e);
|
||||
const ctrlAltModifier = this.deviceSupport.isCtrlKeyPressed(e) && e.altKey && !e.shiftKey;
|
||||
const noModifierKeys = !this.deviceSupport.isCtrlKeyPressed(e) && !e.shiftKey && !e.altKey;
|
||||
const readOnly = this.isReadOnlyRoute || this.readOnlyEnv;
|
||||
|
||||
if (e.key === 's' && ctrlModifier && !readOnly) {
|
||||
@@ -1497,7 +1500,7 @@ export default defineComponent({
|
||||
void this.onRunWorkflow();
|
||||
} else if (e.key === 'S' && shiftModifier && !readOnly) {
|
||||
void this.onAddNodes({ nodes: [{ type: STICKY_NODE_TYPE }], connections: [] });
|
||||
} else if (e.key === this.controlKeyCode) {
|
||||
} else if (e.key === this.deviceSupport.controlKeyCode) {
|
||||
this.ctrlKeyPressed = true;
|
||||
} else if (e.key === ' ') {
|
||||
this.moveCanvasKeyPressed = true;
|
||||
|
||||
Reference in New Issue
Block a user