diff --git a/web/app/dashboard/ai-workflows/_components/workflow-canvas-controls.tsx b/web/app/dashboard/ai-workflows/_components/workflow-canvas-controls.tsx
new file mode 100644
index 0000000..fac5225
--- /dev/null
+++ b/web/app/dashboard/ai-workflows/_components/workflow-canvas-controls.tsx
@@ -0,0 +1,93 @@
+"use client"
+
+import type { ReactNode } from "react"
+import { Maximize2Icon, MinusIcon, PlusIcon, SparklesIcon } from "lucide-react"
+
+import { Button } from "@/components/ui/button"
+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
+
+export function WorkflowCanvasControls({
+ zoomPercent,
+ onZoomIn,
+ onZoomOut,
+ onResetZoom,
+ onFitView,
+ onAutoLayout,
+ autoLayoutDisabled = false,
+}: {
+ zoomPercent?: string
+ onZoomIn?: () => void
+ onZoomOut?: () => void
+ onResetZoom?: () => void
+ onFitView?: () => void
+ onAutoLayout?: () => void
+ autoLayoutDisabled?: boolean
+}) {
+ return (
+
+
+
+
+
+
+ }
+ >
+ {zoomPercent ?? "100%"}
+
+ 重置为 100%
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+function CanvasControlButton({
+ label,
+ onClick,
+ disabled = false,
+ children,
+}: {
+ label: string
+ onClick?: () => void
+ disabled?: boolean
+ children: ReactNode
+}) {
+ return (
+
+
+ }
+ >
+ {children}
+
+ {label}
+
+ )
+}
diff --git a/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx b/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx
index d40ad3a..bfb05ad 100644
--- a/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx
+++ b/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx
@@ -3,18 +3,13 @@
import type { ReactNode } from "react"
import {
CheckCircle2Icon,
- Maximize2Icon,
- MinusIcon,
- PlusIcon,
RotateCcwIcon,
SaveIcon,
SendIcon,
- SparklesIcon,
Undo2Icon,
} from "lucide-react"
import { Button } from "@/components/ui/button"
-import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { cn } from "@/lib/utils"
import type { WorkflowDraftValidation } from "./workflow-utils"
@@ -28,13 +23,6 @@ export function WorkflowEditorToolbar({
undoDisabled = false,
onRedo,
redoDisabled = false,
- onAutoLayout,
- autoLayoutDisabled = false,
- zoomPercent,
- onZoomIn,
- onZoomOut,
- onResetZoom,
- onFitView,
onRestoreDefault,
restoreDefaultDisabled = false,
onValidate,
@@ -52,13 +40,6 @@ export function WorkflowEditorToolbar({
undoDisabled?: boolean
onRedo?: () => void
redoDisabled?: boolean
- onAutoLayout?: () => void
- autoLayoutDisabled?: boolean
- zoomPercent?: string
- onZoomIn?: () => void
- onZoomOut?: () => void
- onResetZoom?: () => void
- onFitView?: () => void
onRestoreDefault?: () => void
restoreDefaultDisabled?: boolean
onValidate?: () => void
@@ -69,7 +50,7 @@ export function WorkflowEditorToolbar({
publishDisabled?: boolean
}) {
return (
-
+
{toolbarExtra}
-
-
-
-
-
-
- }
- >
- {zoomPercent ?? "100%"}
-
- 重置为 100%
-
-
-
-
-
-
-
-
)
}
-
-function WorkflowToolbarIconButton({
- label,
- onClick,
- children,
-}: {
- label: string
- onClick?: () => void
- children: ReactNode
-}) {
- return (
-
-
- }
- >
- {children}
-
- {label}
-
- )
-}
diff --git a/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx b/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx
index 3ba8acd..05ba25e 100644
--- a/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx
+++ b/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx
@@ -25,6 +25,7 @@ import {
WorkflowBranchSelectionProvider,
type SelectedWorkflowBranch,
} from "./workflow-branch-selection"
+import { WorkflowCanvasControls } from "./workflow-canvas-controls"
import { WorkflowConfigPanel } from "./workflow-config-sidebar"
import { WorkflowEditorToolbar } from "./workflow-editor-toolbar"
import {
@@ -341,13 +342,6 @@ function WorkflowEditorInner({
undoDisabled={undoDisabled}
onRedo={onRedo}
redoDisabled={redoDisabled}
- onAutoLayout={() => void autoLayout()}
- autoLayoutDisabled={autoLayouting || definition.nodes.length < 2}
- zoomPercent={zoomPercent}
- onZoomIn={() => playgroundTools.zoomin(true)}
- onZoomOut={() => playgroundTools.zoomout(true)}
- onResetZoom={resetZoom}
- onFitView={() => playgroundTools.fitView(true)}
onRestoreDefault={onRestoreDefault}
restoreDefaultDisabled={restoreDefaultDisabled}
onValidate={onValidate}
@@ -359,6 +353,18 @@ function WorkflowEditorInner({
/>
+
+ playgroundTools.zoomin(true)}
+ onZoomOut={() => playgroundTools.zoomout(true)}
+ onResetZoom={resetZoom}
+ onFitView={() => playgroundTools.fitView(true)}
+ onAutoLayout={() => void autoLayout()}
+ autoLayoutDisabled={autoLayouting || definition.nodes.length < 2}
+ />
+
+