Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'multiple' property in MediaPlaceholder forces gallery [GB3.6.2] #9113

Closed
LuigiPulcini opened this issue Aug 17, 2018 · 4 comments
Closed

'multiple' property in MediaPlaceholder forces gallery [GB3.6.2] #9113

LuigiPulcini opened this issue Aug 17, 2018 · 4 comments
Labels
[Type] Enhancement A suggestion for improvement.

Comments

@LuigiPulcini
Copy link
Contributor

SCENARIO

I am trying to create a Gutenberg block for an audio player I developed. The simplest approach would seem to be rendering a MediaPlaceholder for the users to drag, uploads or select audio files. Since the plugin also creates playlists of multiple audio files, I was experimenting with the multiple property.

PROBLEM

The problem I found is that setting multiple to true forces gallery to be true as well.
The relevant code is on line 130 of the MediaPlaceholder index.js file where both properties multiple and gallery of the MediaUpload component receive the value set for multiple of the MediaPlaceholder.

As a result, the Media uploader disregards the type property (which is set to 'audio') and shows all the mime types.

I am not sure whether this behavior is by design, but of course this prevents us from using the MediaPlaceholder to select multiple files of a specific type.

@designsimply designsimply added [Type] Help Request Help with setup, implementation, or "How do I?" questions. Needs Technical Feedback Needs testing from a developer perspective. labels Aug 17, 2018
@designsimply
Copy link
Member

A playlist block is being worked on in #8396. Consider checking the work there first (if you haven't already!) to see if anything in that code can help answer your question.

@LuigiPulcini
Copy link
Contributor Author

LuigiPulcini commented Aug 17, 2018

Hi, @designsimply,

Thanks for your prompt reply and for pointing me in that direction.
While I can definitely see how to rework my own block according to the way the playlist is being refactored, I still think that assuming that the MediaUpload must be a Gallery only because the multiple property is true is kind of counterintuitive, particularly without performing any check on the type property.

@LuigiPulcini
Copy link
Contributor Author

Regardless of how the playlist block will be eventually implemented, the gallery property of the MediaUpload component invoked by the MediaPlaceholder should not be set to true without checking the type property, as this would limit the development of other audio-based blocks making use of multiple files.

Pull request: #9139

@youknowriad
Copy link
Contributor

Seems like a valid enhancement.

@youknowriad youknowriad added [Type] Enhancement A suggestion for improvement. and removed Needs Technical Feedback Needs testing from a developer perspective. [Type] Help Request Help with setup, implementation, or "How do I?" questions. labels Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants