From e040f8069b476bc15e39474d770950125c6e6568 Mon Sep 17 00:00:00 2001 From: FyhSky Date: Wed, 14 May 2025 19:03:11 +0800 Subject: [PATCH] Support for copying nodes between workflows (This feature is unrelated to remove functions. When using the copy function, the browser will permanently retain the last copied node)." (#19687) Co-authored-by: crazywoola <427733928@qq.com> --- .../components/workflow/store/workflow/workflow-slice.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/store/workflow/workflow-slice.ts b/web/app/components/workflow/store/workflow/workflow-slice.ts index 6bb69cdfcd..e1f2fd91c5 100644 --- a/web/app/components/workflow/store/workflow/workflow-slice.ts +++ b/web/app/components/workflow/store/workflow/workflow-slice.ts @@ -37,8 +37,13 @@ export type WorkflowSliceShape = { export const createWorkflowSlice: StateCreator = set => ({ workflowRunningData: undefined, setWorkflowRunningData: workflowRunningData => set(() => ({ workflowRunningData })), - clipboardElements: [], - setClipboardElements: clipboardElements => set(() => ({ clipboardElements })), + clipboardElements: (() => { + const storedElements = localStorage.getItem('clipboard_elements') + return storedElements ? JSON.parse(storedElements) : [] + })(), + setClipboardElements: (clipboardElements) => { + localStorage.setItem('clipboard_elements', JSON.stringify(clipboardElements)) + }, selection: null, setSelection: selection => set(() => ({ selection })), bundleNodeSize: null,