feat(editor): Show actions in focus panel when multiple nodes are selected (no-changelog) (#18984)

This commit is contained in:
Suguru Inoue
2025-09-03 13:40:00 +02:00
committed by GitHub
parent d8eb1a97e6
commit 95952902f0
18 changed files with 432 additions and 305 deletions

View File

@@ -12,6 +12,7 @@ import {
watch,
h,
onBeforeUnmount,
useTemplateRef,
} from 'vue';
import { onBeforeRouteLeave, useRoute, useRouter } from 'vue-router';
import WorkflowCanvas from '@/components/canvas/WorkflowCanvas.vue';
@@ -144,6 +145,7 @@ import { useFocusPanelStore } from '@/stores/focusPanel.store';
import { useAITemplatesStarterCollectionStore } from '@/experiments/aiTemplatesStarterCollection/stores/aiTemplatesStarterCollection.store';
import { useReadyToRunWorkflowsStore } from '@/experiments/readyToRunWorkflows/stores/readyToRunWorkflows.store';
import { useKeybindings } from '@/composables/useKeybindings';
import { type ContextMenuAction } from '@/composables/useContextMenuItems';
defineOptions({
name: 'NodeView',
@@ -263,6 +265,7 @@ useKeybindings({
ctrl_alt_o: () => uiStore.openModal(ABOUT_MODAL_KEY),
});
const canvasRef = useTemplateRef('canvas');
const isLoading = ref(true);
const isBlankRedirect = ref(false);
const readOnlyNotification = ref<null | { visible: boolean }>(null);
@@ -885,6 +888,10 @@ async function onSaveWorkflow() {
}
}
function onContextMenuAction(action: ContextMenuAction, nodeIds: string[]) {
canvasRef.value?.executeContextMenuAction(action, nodeIds);
}
function addWorkflowSavedEventBindings() {
canvasEventBus.on('saved:workflow', npsSurveyStore.fetchPromptsData);
canvasEventBus.on('saved:workflow', onSaveFromWithinNDV);
@@ -2043,6 +2050,7 @@ onBeforeUnmount(() => {
<div :class="$style.wrapper">
<WorkflowCanvas
v-if="editableWorkflow && editableWorkflowObject && !isLoading"
ref="canvas"
:id="editableWorkflow.id"
:workflow="editableWorkflow"
:workflow-object="editableWorkflowObject"
@@ -2202,6 +2210,7 @@ onBeforeUnmount(() => {
v-if="!isLoading"
:is-canvas-read-only="isCanvasReadOnly"
@save-keyboard-shortcut="onSaveWorkflow"
@context-menu-action="onContextMenuAction"
/>
</div>
</template>