statamic / ideas

đź’ˇDiscussions on ideas and feature requests for Statamic
https://statamic.dev
30 stars 1 forks source link

Move sets between sets #748

Open edalzell opened 2 years ago

edalzell commented 2 years ago

We have a heavily nested page builder (replicator/bard inception).

"Ability to move a block to another nested area (i.e. Let's say I nested a bunch of grid_1 but then decided to start another Grid block someone else on the page and want to move one of the grid_1 to the new location) *I encounter this so often and this is a huge time waster to remake a block"

Would be great if we could copy/move our block between sets.

jacksleight commented 1 year ago

Following a conversation on Discord I had a play around with copying sets between replicators. Got the basics working but then ran into a fun(?) problem:

How do you check whether a set is valid for the target replicator? Ideas so far:

  1. Check that the source and target field paths (excluding numerical indexes) match. This would allow copying between pages and parent sets, but prevent copying to differently named fields that use the same config.
  2. Check that the set handle exists in the target’s set list. Would work if people are careful with their set handles, but they don’t have to be unique across replicators so there’s a chance they could conflict.
  3. Do some sort of hashing of the set configs and use those to check that the target contains a matching config. Assuming this is actually possible it might be the most robust, but it’s also the most complicated.
  4. Do nothing and let people get invalid set errors, and possibly invalid values. This is already possible in Bard and it doesn’t appear to have come up as an issue. 🤷‍♂️

Be interested if anyone has any thoughts on this?

It’s a feature I’d love to have and I’d be happy to work on a PR for it, but I’m a bit stumped right now.

K3CK commented 1 year ago

I think I'd go with number 1 for a start, if I understood it correctly (not 100% sure what you mean with "prevent copying to differently named fields that use the same config").

For me the most common use case is that I have a replicator with a number of sets that I use on different pages. Sometimes I then want to copy a built out set from page A and paste it to the same replicator field on page B.

For what I understand this would be possible with your suggestion number 1. The replicators' handles have to match to be able to copy/paste between them.

If this means I can't copy/paste between replicators with different handles but shared sets, I'd be fine with that. I think that's a not so common use case and could maybe tackled later.

StudioNautilus commented 1 year ago

Samesies on this one! While the editing experience of statamic is amazing, this turns out to be a bit of a bottleneck.