Loading...
A Hook for copying and pasting nodes and edges.
const { copy, paste, cut } = useClipboard();
const {copy: (ids, copyOptions) => void,paste: (ids, cutOptions) => void,cut: (pasteOptions) => void} = useClipboard();
Parameter | Description | Type |
---|---|---|
copy | Copy elements | (ids: string[], copyOptions?: CopyOptions) => void |
paste | Render elements | (ids: string[], cutOptions?: CopyOptions) => void |
cut | Render elements | (pasteOptions?: PasteOptions) => Cell[] |
CopyOptions parameters are as follows
Parameter | Description | Type | Default Value |
---|---|---|---|
deep | Whether to recursively copy all child nodes/edges. | boolean | - |
useLocalStorage | Whether to save the copied nodes/edges in localStorage | boolean | - |
PasteOptions parameters are as follows
Parameter | Description | Type | Default Value |
---|---|---|---|
offset | Offset for pasting nodes/edges onto the canvas | number | { dx: number; dy: number } | 20 |
useLocalStorage | Whether to use nodes/edges from localStorage | boolean | - |
nodeProps | Additional properties for nodes pasted onto the canvas | Node.Properties | - |
edgeProps | Additional properties for edges pasted onto the canvas | Edge.Properties | - |
None