feat: add WorkflowLineAddButton and WorkflowLineNodePanel components for enhanced workflow editing

This commit is contained in:
mlogclub
2026-06-28 20:22:18 +08:00
parent 47660c9f1d
commit eaffca5bad
5 changed files with 203 additions and 0 deletions
@@ -8,6 +8,8 @@ import {
type WorkflowNodeEntity,
type WorkflowJSON,
} from "@flowgram.ai/free-layout-editor"
import { createFreeLinesPlugin } from "@flowgram.ai/free-lines-plugin"
import { createFreeNodePanelPlugin } from "@flowgram.ai/free-node-panel-plugin"
import { createFreeSnapPlugin } from "@flowgram.ai/free-snap-plugin"
import { createMinimapPlugin } from "@flowgram.ai/minimap-plugin"
@@ -15,6 +17,8 @@ import type { AIWorkflowDefinition, AIWorkflowNodeSpec } from "@/lib/api/admin"
import { FlowgramNodeRenderer } from "./flowgram-node-renderer"
import { buildFlowgramNodeRegistries } from "./flowgram-node-registries"
import { WorkflowLineAddButton } from "./workflow-line-add-button"
import { WorkflowLineNodePanel } from "./workflow-line-node-panel"
import {
normalizeConditionPortsForFlowgram,
syncConditionBranchTargetsFromEdges,
@@ -84,6 +88,17 @@ export function useFlowgramEditorProps({
}
},
plugins: () => [
createFreeLinesPlugin({
renderInsideLine: WorkflowLineAddButton,
}),
createFreeNodePanelPlugin({
renderer: (props) => (
<WorkflowLineNodePanel
{...props}
nodeSpecs={nodeSpecs}
/>
),
}),
createMinimapPlugin({
disableLayer: true,
}),