Add button text and close prop to MediaUpload #15969
Labels
[Feature] Media
Anything that impacts the experience of managing media
[Type] Enhancement
A suggestion for improvement.
Describe the bug
In WordPress core, it's possible to invoke a Media modal with
wp.media()
and pass a couple properties to the modal "Select" button, ie: the button in the bottom right:In the Gutenberg
MediaUpload
it is possible to pass only the Modal title, see:gutenberg/packages/media-utils/src/components/media-upload/index.js
Lines 78 to 107 in bd76217
1
passing a button text prop seems pretty simple to me and would allow parity with the current usage, when plugins or other core workflows need a better button text.
2
in core, the
close
prop is set to false when it is necessary to not close the modal and switch to another state/view, for example when the following step is the image cropping (see legacy custom header, custom background pages, and in the Customizer).I'm not sure if in Gutenberg there is already a way to not close the modal (couldn't find it). If there's none, I'd tend to think it is necessary to implement a similar feature to allow for custom workflows.
Note:
MediaUpload
has just been extracted to its own package in #15521 /Cc @jorgefilipecostaThe text was updated successfully, but these errors were encountered: