sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Enable copy/paste of object/array data in Studio

Open fabien opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe.

There's currently no way to copy data structures from object and array fields between documents or fields of a document. This would also include reference fields.

Describe the solution you'd like

It would be interesting to have this feature (as a configurable field option) so it would show as an icon to the side of such field, for example the three-dotted 'more' icon. A menu would allow copy, and once copied, fields would enable the paste option in that menu as well.

I addition, even though we can duplicate a document, having copy/paste functionality on the document level would also be useful. I can also see this being tied into the 'Inspect' panel, allowing JSON to be copied/pasted there and edited manually. This should also be configurable in the schema.

fabien avatar Dec 09 '21 10:12 fabien

+1

This is something my clients asked several times and It also would help me personally while developing.

@fabien I guess this issue should ask for a "Multi-Document" copy-paste feature.

Example: Copy an entire object or array or array item to another document.

surjithctly avatar Dec 16 '21 14:12 surjithctly

+1

Our clients are also asking for this.

jonahark avatar Feb 23 '22 09:02 jonahark

+1 This would be of great help!

hectorg2211 avatar Jul 04 '22 13:07 hectorg2211

+1 This is a feature I'm missing when I am filling in content in sanity

lukaskbold avatar Jul 22 '22 12:07 lukaskbold

+1 Boss has wanted this for a while.

bline avatar Jul 22 '22 13:07 bline

+1 This would save so much time!

samuelsurgeon avatar Jul 27 '22 01:07 samuelsurgeon

+1 This is definitely a must-have for content creators!

synim-sogody avatar Oct 13 '22 08:10 synim-sogody

+1

Use case: structuring website with modules grouped into sections. This is possible right now, but if an editor decides they want to change a module to a different section, they have to recreate the module in the other section manually. This feature would allow just copying/cutting the module from the array in the old section to the array in the new section.

To simplify, I would suggest only allow copy/pasting between arrays with the exact same schema (works for my use case, not sure about others).

fvieira avatar Dec 28 '22 19:12 fvieira

+1 My use case is similar to @fvieira It would be amazing to have this feature since manually recreating a module in another document is tedious sometimes, allowing object/array paste would make this process a lot smoother.

raulsaavedrax avatar Mar 14 '23 14:03 raulsaavedrax

Definitely a necessity!

alexanderkalachev avatar Mar 29 '23 13:03 alexanderkalachev

Clients ask about this first thing: "Yeah, but how do I copy these like in other CMS's?"

It's definitely a fundamental feature would help both editors and developers save tons of time.

Hahlh avatar Apr 24 '23 18:04 Hahlh

+1 for being able to paste in the JSON for the document database. If the field is not known to the schema, then that's on the user. The studio already handles when a field on the data is unknown to the schema.

Basically 'replace' the 'raw JSON' content, if I'm understanding this. That's what I'd like to do too.

dooferorg avatar May 08 '23 20:05 dooferorg

We have built a small POC and might extend it over the coming weeks:

https://github.com/sanity-io/sanity/assets/45669613/6372596b-e917-4266-88d2-712546b4b8cf

This is only a small proof of concept and would need to be adapted to various cases like images and references. It's likely also reasonable to first limit this to arrays of the same type.

In case you are interested to build something yourself, you can have a look at the code here:

https://github.com/KasayoDotCom/sanity-copypaste-poc

Hahlh avatar May 12 '23 20:05 Hahlh

Hey everyone! At the end of April, we at @superside-oss built a full-functioning plugin for Sanity Studio, which covers this case.

You can install it from here: https://www.sanity.io/plugins/copy-paste

@Hahlh we'd love to see you as a contributor to our repo: https://github.com/superside-oss/sanity-copy-paste!

dnzg avatar Jun 04 '23 07:06 dnzg