fix(editor): Fit view when only "Add first step" placeholder is visible (no-changelog) (#11294)

This commit is contained in:
Raúl Gómez Morales 2024-10-17 13:19:48 +02:00 committed by GitHub
parent d330b6b94a
commit c79aa01a48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,
});