mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Fit view when only "Add first step" placeholder is visible (no-changelog) (#11294)
This commit is contained in:
committed by
GitHub
parent
d330b6b94a
commit
c79aa01a48
@@ -31,6 +31,7 @@ import { GRID_SIZE } from '@/utils/nodeViewUtils';
|
|||||||
import { CanvasKey } from '@/constants';
|
import { CanvasKey } from '@/constants';
|
||||||
import { onKeyDown, onKeyUp, useDebounceFn } from '@vueuse/core';
|
import { onKeyDown, onKeyUp, useDebounceFn } from '@vueuse/core';
|
||||||
import CanvasArrowHeadMarker from './elements/edges/CanvasArrowHeadMarker.vue';
|
import CanvasArrowHeadMarker from './elements/edges/CanvasArrowHeadMarker.vue';
|
||||||
|
import { CanvasNodeRenderType } from '@/types';
|
||||||
|
|
||||||
const $style = useCssModule();
|
const $style = useCssModule();
|
||||||
|
|
||||||
@@ -108,6 +109,7 @@ const {
|
|||||||
nodes: graphNodes,
|
nodes: graphNodes,
|
||||||
onPaneReady,
|
onPaneReady,
|
||||||
findNode,
|
findNode,
|
||||||
|
onNodesInitialized,
|
||||||
} = useVueFlow({ id: props.id, deleteKeyCode: null });
|
} = useVueFlow({ id: props.id, deleteKeyCode: null });
|
||||||
|
|
||||||
const isPaneReady = ref(false);
|
const isPaneReady = ref(false);
|
||||||
@@ -479,6 +481,11 @@ onPaneReady(async () => {
|
|||||||
isPaneReady.value = true;
|
isPaneReady.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onNodesInitialized((nodes) => {
|
||||||
|
if (nodes.length !== 1 || nodes[0].data?.render.type !== CanvasNodeRenderType.AddNodes) return;
|
||||||
|
void onFitView();
|
||||||
|
});
|
||||||
|
|
||||||
watch(() => props.readOnly, setReadonly, {
|
watch(() => props.readOnly, setReadonly, {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user