Skip to content
Snippets Groups Projects

#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
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • utkarsh_33 added 1 commit

    added 1 commit

    Compare with previous version

  • Kyle Einecker added 1 commit

    added 1 commit

    • 8f1cfb3a - Update modifier logic for copy/paste shortcuts.

    Compare with previous version

  • utkarsh_33 added 12 commits

    added 12 commits

    • 8f1cfb3a...a79008e3 - 4 commits from branch project:0.x
    • 1bcdd039 - Added tests
    • 6fdb3071 - Issue #3471028 by deepakkm, tedbow, akhil babu: Expand test coverage in FieldUninstallValidatorTest
    • b09bce7b - Issue #3476891: FieldTypeUninstallValidator lists the same content revision 2x...
    • b14197e0 - Issue #3470647 by shyam_bhatt, omkar-pd, jessebaker: Zoom Behaviour Issue:...
    • a7ee7018 - Issue #3476204 by cosmicdreams, jessebaker, bnjmnm, deepakkm, wim leers,...
    • c161c88f - Added logic to take care of refreshs
    • eb0e5d26 - Added a seperate paste reducer
    • 84095794 - Merge branch '0.x' into 3462633-allow-copy-pasting

    Compare with previous version

  • utkarsh_33 added 1 commit

    added 1 commit

    Compare with previous version

  • utkarsh_33 added 3 commits

    added 3 commits

    • 51eb9158 - 1 commit from branch project:0.x
    • 20f6fe6b - Attempt to fix UI eslint
    • 3aeae935 - Merge branch '0.x' into 3462633-allow-copy-pasting

    Compare with previous version

  • utkarsh_33 added 1 commit

    added 1 commit

    • d1ad99b9 - Removed unwanted console log

    Compare with previous version

  • utkarsh_33 added 8 commits

    added 8 commits

    Compare with previous version

  • utkarsh_33 marked this merge request as ready

    marked this merge request as ready

  • utkarsh_33 added 4 commits

    added 4 commits

    Compare with previous version

  • utkarsh_33 added 1 commit

    added 1 commit

    Compare with previous version

  • Jesse Baker
  • Jesse Baker
  • I have tested and given a look at the code. Testing it manually, it doesn't work at all and looking at the code I can see that the issue is that you are only storing a uuid on the clipboard but need to store the actual model data as JSON.

    The Cypress test is flawed and asserts something that is true even if you remove the commands to press cmd+c and cmd+v so it's giving a false positive which is why it's still passing the Cypress tests.

  • Jesse Baker requested changes

    requested changes

  • utkarsh_33 added 1 commit

    added 1 commit

    Compare with previous version

  • Ben Mullins added 1 commit

    added 1 commit

    • 69dbbb5e - this works manually but I can't currently get the Meta-C and Meta-V to register in Cypress

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading