Copy & Paste all items (#302)

* Add copy & paste of groups & reroutes

Complete rewrite of copy & paste
Fixes a bug where failure to clone a node would corrupt all subsequent nodes
No longer mutates nodes when copying

* Fix name collision

* Fix cannot copy specified nodes to clipboard

* Allow mapping of original IDs to pasted clones
This commit is contained in:
filtered
2024-11-14 02:21:23 +11:00
committed by GitHub
parent 4c0c05ee6d
commit cc084811d9
3 changed files with 177 additions and 95 deletions

View File

@@ -84,6 +84,14 @@ export interface ISerialisedGroup {
export type TClipboardLink = [targetRelativeIndex: number, originSlot: number, nodeRelativeIndex: number, targetSlot: number, targetNodeId: NodeId]
/** Items copied from the canvas */
export interface ClipboardItems {
nodes?: ISerialisedNode[]
groups?: ISerialisedGroup[]
reroutes?: SerialisableReroute[]
links?: SerialisableLLink[]
}
/** */
export interface IClipboardContents {
nodes?: ISerialisedNode[]