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