Skip to content

#3462633 : Allow copy pasting components with CTRL+C and CTRL+V.

insertNode and insertMultipleNodes have been consolidated into one action: insertNodes . Now, even when only inserting a single item to the layout, it's expected that we pass a full layoutModel. This addresses issue #3472089**.**

Introduced a new hook useCopyPasteComponents that returns the copy and paste functions used by the meta+c and meta+v useHotkeys in Canvas.tsx .

Implemented copy and paste Cypress e2e tests and also grabbed the Cypress unit test from over in #3472089.

Cmd/ctrl+C and cmd/ctrl+v now perform a "copy and paste" like action that uses the browser's local storage but not the system clipboard. This allows us to enforce that copy and pasting only occurs between the same site on the same domain and prevents issues like people trying to copy an instance of an SDC from a layout one site to another even though none of the SDC files would move with it!

Copy and pasting a parent component that has slots/children will also copy all of the children.

After pasting a component the selected component state is updated to be the component you just pasted (the parent in the case where it has children).

Closes #3462633

Edited by Jesse Baker

Merge request reports

Loading