From 052f638bec8bc8e1aeeca5791dd0ba736a784f6f Mon Sep 17 00:00:00 2001 From: FyhSky Date: Fri, 16 May 2025 15:57:58 +0800 Subject: [PATCH] Support for copying nodes between workflows. --- .../workflow/store/workflow/workflow-slice.ts | 10 ++++++++-- 1 file changed, 8 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..d034080b52 100644 --- a/web/app/components/workflow/store/workflow/workflow-slice.ts +++ b/web/app/components/workflow/store/workflow/workflow-slice.ts @@ -37,8 +37,14 @@ 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) => { + set(() => ({ clipboardElements })) + localStorage.setItem('clipboard_elements', JSON.stringify(clipboardElements)) + }, selection: null, setSelection: selection => set(() => ({ selection })), bundleNodeSize: null,