refactor(editor): Apply Prettier (no-changelog) (#4920)

*  Adjust `format` script

* 🔥 Remove exemption for `editor-ui`

* 🎨 Prettify

* 👕 Fix lint
This commit is contained in:
Iván Ovejero
2022-12-14 10:04:10 +01:00
committed by GitHub
parent bcde07e032
commit 5ca2148c7e
284 changed files with 19247 additions and 15540 deletions

View File

@@ -7,15 +7,17 @@ import { useWorkflowsStore } from '@/stores/workflows';
import { useNodeTypesStore } from '@/stores/nodeTypes';
import { useUIStore } from '@/stores/ui';
import { INodeUi, XYPosition } from '@/Interface';
import {
scaleBigger,
scaleReset,
scaleSmaller,
} from '@/utils';
import { scaleBigger, scaleReset, scaleSmaller } from '@/utils';
import { START_NODE_TYPE } from '@/constants';
import '@/plugins/N8nCustomConnectorType';
import '@/plugins/PlusEndpointType';
import { DEFAULT_PLACEHOLDER_TRIGGER_BUTTON, getMidCanvasPosition, getNewNodePosition, getZoomToFit, PLACEHOLDER_TRIGGER_NODE_SIZE } from '@/utils/nodeViewUtils';
import {
DEFAULT_PLACEHOLDER_TRIGGER_BUTTON,
getMidCanvasPosition,
getNewNodePosition,
getZoomToFit,
PLACEHOLDER_TRIGGER_NODE_SIZE,
} from '@/utils/nodeViewUtils';
export const useCanvasStore = defineStore('canvas', () => {
const workflowStore = useWorkflowsStore();
@@ -24,10 +26,10 @@ export const useCanvasStore = defineStore('canvas', () => {
const jsPlumbInstance = jsPlumb.getInstance();
const nodes = computed<INodeUi[]>(() => workflowStore.allNodes);
const triggerNodes = computed<INodeUi[]>(
() => nodes.value.filter(
node => node.type === START_NODE_TYPE || nodeTypesStore.isTriggerNode(node.type),
),
const triggerNodes = computed<INodeUi[]>(() =>
nodes.value.filter(
(node) => node.type === START_NODE_TYPE || nodeTypesStore.isTriggerNode(node.type),
),
);
const isDemo = ref<boolean>(false);
const nodeViewScale = ref<number>(1);
@@ -62,7 +64,7 @@ export const useCanvasStore = defineStore('canvas', () => {
};
const resetZoom = () => {
const {scale, offset} = scaleReset({
const { scale, offset } = scaleReset({
scale: nodeViewScale.value,
offset: uiStore.nodeViewOffsetPosition,
});
@@ -70,7 +72,7 @@ export const useCanvasStore = defineStore('canvas', () => {
};
const zoomIn = () => {
const {scale, offset} = scaleBigger({
const { scale, offset } = scaleBigger({
scale: nodeViewScale.value,
offset: uiStore.nodeViewOffsetPosition,
});
@@ -78,7 +80,7 @@ export const useCanvasStore = defineStore('canvas', () => {
};
const zoomOut = () => {
const {scale, offset} = scaleSmaller({
const { scale, offset } = scaleSmaller({
scale: nodeViewScale.value,
offset: uiStore.nodeViewOffsetPosition,
});
@@ -87,18 +89,21 @@ export const useCanvasStore = defineStore('canvas', () => {
const zoomToFit = () => {
const nodes = getNodesWithPlaceholderNode();
if (!nodes.length) { // some unknown workflow executions
if (!nodes.length) {
// some unknown workflow executions
return;
}
const {zoomLevel, offset} = getZoomToFit(nodes, !isDemo.value);
const { zoomLevel, offset } = getZoomToFit(nodes, !isDemo.value);
setZoomLevel(zoomLevel, offset);
};
const wheelMoveWorkflow = (e: WheelEvent) => {
const normalized = normalizeWheel(e);
const offsetPosition = uiStore.nodeViewOffsetPosition;
const nodeViewOffsetPositionX = offsetPosition[0] - (e.shiftKey ? normalized.pixelY : normalized.pixelX);
const nodeViewOffsetPositionY = offsetPosition[1] - (e.shiftKey ? normalized.pixelX : normalized.pixelY);
const nodeViewOffsetPositionX =
offsetPosition[0] - (e.shiftKey ? normalized.pixelY : normalized.pixelX);
const nodeViewOffsetPositionY =
offsetPosition[1] - (e.shiftKey ? normalized.pixelX : normalized.pixelY);
uiStore.nodeViewOffsetPosition = [nodeViewOffsetPositionX, nodeViewOffsetPositionY];
};