1

I have seen a few tutorials around utilizing the MediaUpload component from below.

https://github.com/WordPress/gutenberg/tree/master/packages/editor/src/components/media-upload

But none of them demonstrate it with the default gallery functionality that is common pre-Gutenberg. For example the ability to select multiple images and then be taken to a second screen where you can order and caption them. See attachments if further info is needed.

There is the multiple attribute which can be set to "true" or "add" but it doesn't toggle the second screen for ordering the items or captioning them.

1st Screen

2nd Screen

1

1 Answer 1

1

It isn't documented but if we take a look to the gallery block, we see it passes an extra prop to the MediaUpload component.

Try to pass gallery as well as multiple to the component.

2
  • Thanks for the tip, I appreciate the prompt response! Is there any documentation for it besides the source? I'm getting unexpected results, e.g. passing in an empty array for values and all images are selected by default :/ Jan 18, 2019 at 14:11
  • @DevonMather Glad it helped. I don't know, I always check the github repository (as the handbook takes the content from there, if I'm correct). There I can check the actual code of the component in the same place. Maybe you can open another question or extend this one?
    – Alvaro
    Jan 18, 2019 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.