sanity-io/sanity-plugin-cloudinary

Multiple image upload when using cloudinary asset as child in separate object

Opened this issue · 3 comments

Is it possible to add support for multiple select with nested objects? Let me show you our use-case.

We have a field defined like this:

    defineField({
      name: 'imageGallery',
      type: 'array',
      title: 'Image gallery',
      of: [{
        name: 'imageWithDescription',
        fields: [cloudinaryAsset, textField]
      }],
    }),

The plugin has support for multiple select when the cloudinary asset is a direct child of the of[] list. However, when it is nested in a new object this is not possible.

Would it be possible to change this logic to support nested arrays for example?

const cloudinaryType = props.schemaType.of.find(

The reasoning here is that this follows the same logic as the studio does for drag and drop. It works for image arrays, but not for other patterns (you might also want to deeply nest the image or have multiple types for the user to select between).

When we extend the mapping function for the studio generally we should think about extending the API for asset sources as well. It's a great suggestion so will leave this open.

Anything new on this issues @evenwestvang?