From 0870739a7d28479612663a8dacc1154c259258cb Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 11 Apr 2026 23:36:46 +0800 Subject: [PATCH] fix: stabilize flow board node insertion --- components/canvas/EnhanceProWorkspace.tsx | 58 ++++++--------------- components/canvas/RealtimeCanvasDialog.tsx | 34 ++++++------ components/flow-board/drawnix-workspace.tsx | 26 +++++++-- 3 files changed, 58 insertions(+), 60 deletions(-) diff --git a/components/canvas/EnhanceProWorkspace.tsx b/components/canvas/EnhanceProWorkspace.tsx index 9b1aeb600..41bb67205 100644 --- a/components/canvas/EnhanceProWorkspace.tsx +++ b/components/canvas/EnhanceProWorkspace.tsx @@ -359,6 +359,7 @@ function buildEnhanceSourcePayload( interface EnhanceProWorkspaceProps { sourceImageUrl?: string | null; + onRequestAddImage?: () => void; onApplyResult: (payload: { imageUrl: string; prompt: string; @@ -371,6 +372,7 @@ interface EnhanceProWorkspaceProps { export function EnhanceProWorkspace({ sourceImageUrl, + onRequestAddImage, onApplyResult, }: EnhanceProWorkspaceProps) { const [isSubmitting, setIsSubmitting] = useState(false); @@ -734,47 +736,21 @@ export function EnhanceProWorkspace({ ) : ( -
-
-
-
- -
-
-
Enhance Pro Studio
-
- 还没有可增强的图片 -
-
- 先在主画布里选中一张图片,或者先在实时画布模式里生成结果, - 再切回这里进行精修、增强和细节重建。 -
-
-
-
-
-
- Step 01 -
-
- 选中一张图 -
-
- 从主画布中选择要增强的图片,系统会自动把它带入当前工作台。 -
-
-
-
- Step 02 -
-
- 调参后开始增强 -
-
- 使用右侧工具卡片快速选择模式、强度和增强范围,生成后可直接发回画布。 -
-
-
+
+ +
+ 选择本地图片后即可开始图像增强 Pro
)} diff --git a/components/canvas/RealtimeCanvasDialog.tsx b/components/canvas/RealtimeCanvasDialog.tsx index 1febf064e..2a6451695 100644 --- a/components/canvas/RealtimeCanvasDialog.tsx +++ b/components/canvas/RealtimeCanvasDialog.tsx @@ -3336,9 +3336,27 @@ export function RealtimeCanvasDialog({
) : null} + + + {workspaceMode === "enhance-pro" ? ( uploadInputRef.current?.click()} sourceImageUrl={enhanceSourceImageUrl} /> ) : ( @@ -3592,22 +3610,6 @@ export function RealtimeCanvasDialog({
- -
normalizeFlowBoardElementText(element)) - : []; + if (!Array.isArray(children)) { + return []; + } + + let changed = false; + const nextChildren = children.map((element) => { + const nextElement = normalizeFlowBoardElementText(element); + if (nextElement !== element) { + changed = true; + } + return nextElement; + }); + + return changed ? nextChildren : (children as PlaitElement[]); } function seedFlowBoardDefaultTextColor() { @@ -1009,6 +1020,9 @@ export function DrawnixWorkspace({ const handleValueChange = useCallback( (children: PlaitElement[]) => { + if (snapshotRef.current.children === children) { + return; + } updateSnapshot({ children }); refreshMarkerSelectionState(); }, @@ -1017,6 +1031,9 @@ export function DrawnixWorkspace({ const handleViewportChange = useCallback( (viewport: Viewport) => { + if (snapshotRef.current.viewport === viewport) { + return; + } updateSnapshot({ viewport }); }, [updateSnapshot] @@ -1024,6 +1041,9 @@ export function DrawnixWorkspace({ const handleThemeChange = useCallback( (themeColorMode: ThemeColorMode) => { + if (snapshotRef.current.theme?.themeColorMode === themeColorMode) { + return; + } updateSnapshot({ theme: { themeColorMode } }); }, [updateSnapshot]