Fix copy paste not being able to paste on other flow
This commit is contained in:
parent
3d4200fc82
commit
31c80204eb
3 changed files with 14 additions and 5 deletions
|
|
@ -43,6 +43,7 @@ import { cn, getRandomName, isWrappedWithClass } from "../../../../utils/utils";
|
||||||
import ConnectionLineComponent from "../ConnectionLineComponent";
|
import ConnectionLineComponent from "../ConnectionLineComponent";
|
||||||
import SelectionMenu from "../SelectionMenuComponent";
|
import SelectionMenu from "../SelectionMenuComponent";
|
||||||
import ExtraSidebar from "../extraSidebarComponent";
|
import ExtraSidebar from "../extraSidebarComponent";
|
||||||
|
import { stat } from "fs";
|
||||||
|
|
||||||
const nodeTypes = {
|
const nodeTypes = {
|
||||||
genericNode: GenericNode,
|
genericNode: GenericNode,
|
||||||
|
|
@ -64,11 +65,6 @@ export default function Page({
|
||||||
const setFilterEdge = useTypesStore((state) => state.setFilterEdge);
|
const setFilterEdge = useTypesStore((state) => state.setFilterEdge);
|
||||||
const reactFlowWrapper = useRef<HTMLDivElement>(null);
|
const reactFlowWrapper = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const [lastCopiedSelection, setLastCopiedSelection] = useState<{
|
|
||||||
nodes: any;
|
|
||||||
edges: any;
|
|
||||||
} | null>(null);
|
|
||||||
|
|
||||||
const reactFlowInstance = useFlowStore((state) => state.reactFlowInstance);
|
const reactFlowInstance = useFlowStore((state) => state.reactFlowInstance);
|
||||||
const setReactFlowInstance = useFlowStore(
|
const setReactFlowInstance = useFlowStore(
|
||||||
(state) => state.setReactFlowInstance
|
(state) => state.setReactFlowInstance
|
||||||
|
|
@ -86,6 +82,10 @@ export default function Page({
|
||||||
const redo = useFlowsManagerStore((state) => state.redo);
|
const redo = useFlowsManagerStore((state) => state.redo);
|
||||||
const takeSnapshot = useFlowsManagerStore((state) => state.takeSnapshot);
|
const takeSnapshot = useFlowsManagerStore((state) => state.takeSnapshot);
|
||||||
const paste = useFlowStore((state) => state.paste);
|
const paste = useFlowStore((state) => state.paste);
|
||||||
|
const lastCopiedSelection = useFlowStore((state) => state.lastCopiedSelection);
|
||||||
|
const setLastCopiedSelection = useFlowStore(
|
||||||
|
(state) => state.setLastCopiedSelection
|
||||||
|
);
|
||||||
|
|
||||||
const position = useRef({ x: 0, y: 0 });
|
const position = useRef({ x: 0, y: 0 });
|
||||||
const [lastSelection, setLastSelection] =
|
const [lastSelection, setLastSelection] =
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,10 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
});
|
});
|
||||||
set({ edges: newEdges });
|
set({ edges: newEdges });
|
||||||
},
|
},
|
||||||
|
lastCopiedSelection: null,
|
||||||
|
setLastCopiedSelection: (newSelection) => {
|
||||||
|
set({ lastCopiedSelection: newSelection });
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export default useFlowStore;
|
export default useFlowStore;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,11 @@ export type FlowStoreType = {
|
||||||
selection: { nodes: any; edges: any },
|
selection: { nodes: any; edges: any },
|
||||||
position: { x: number; y: number; paneX?: number; paneY?: number }
|
position: { x: number; y: number; paneX?: number; paneY?: number }
|
||||||
) => void;
|
) => void;
|
||||||
|
lastCopiedSelection: { nodes: any; edges: any } | null;
|
||||||
|
setLastCopiedSelection: (
|
||||||
|
newSelection: { nodes: any; edges: any } | null
|
||||||
|
) => void;
|
||||||
isBuilt: boolean;
|
isBuilt: boolean;
|
||||||
setIsBuilt: (isBuilt: boolean) => void;
|
setIsBuilt: (isBuilt: boolean) => void;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue