Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Ability to cut/copy/paste replicator sets #10359

Open
wants to merge 7 commits into
base: 5.x
Choose a base branch
from

Conversation

jacksleight
Copy link
Contributor

@jacksleight jacksleight commented Jun 24, 2024

This PR adds the ability to cut/copy/paste sets between different replicators/pages/tabs:

CleanShot.2024-07-12.at.16.59.51.mp4

Notes

  • Replicators use a list of set config hashes to decide whether the set being copied is compatible with the target replicator.
  • Due to its limitations this does not use the Clipboard API. Instead, within the current page the data is stored in a vue component (for reactivity), and local storage is used to persist it between pages/tabs (session storage isn’t suitable as it doesn’t work between tabs).
  • Since local storage has no expiry but you don’t want copied values hanging around forever a unique ID stored in a session cookie is attached to the data, so it can be cleared when a new session is started.
  • There's a new $clipboard object that takes care of all the data storage and tracking, this means it should be fairly straightforward to add the same feature to other fieldtypes in the future (if wanted).
  • I don't really like the fact that the paste buttons hang around (and have taken the steps above to ensure they don't stay there forever). It wouldn't make sense to clear the data on paste since you might want to paste multiple times. Maybe the paste option shouldn't be a button at all, it could be in the [5.x] Add field actions feature #10352 menu. That would also simplify adding the same feature to other fieldtypes since there's no longer any replicator specific UI.
  • If the button does stay it needs a better icon, hopefully there's a good one in the streamline set.
  • I would like to add Cut/Copy All Sets options, but I'm going to wait for [5.x] Add field actions feature #10352 before looking at that.

Other Changes

This PR includes the same "Other Changes" as #10361, since they're related and using the same hashes.

Closes statamic/ideas#748

@jacksleight jacksleight marked this pull request as ready for review July 12, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move sets between sets
1 participant