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

MediaPlaceholder multiple and gallery properties #9139

Merged
merged 4 commits into from Aug 24, 2018

Conversation

Projects
None yet
2 participants
@LuigiPulcini
Contributor

LuigiPulcini commented Aug 19, 2018

The gallery property should be set to true only after checking that the selected type of media is not audio.

Description

The MediaPlaceholder component can be used to select multiple files also with audio files. In addition to being counterintuitive, forcing gallery to be true only based on the multiple property does not allow to work with audio files. In fact, when type is set to "audio" and multiple is true, the MediaUpload component only shows images

Additional Information

In addition to the proposed change, it could be possible to add another line as follows:

playlist={ multiple && type === "audio" }

This could be done when a playlist block is finally added to Gutenberg.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
MediaPlaceholder multiple property
The `gallery` property should be set to `true` only after checking that the selected `type` of media is not `audio`.

@LuigiPulcini LuigiPulcini changed the title from MediaPlaceholder multiple property to MediaPlaceholder multiple and gallery properties Aug 19, 2018

gallery and playlist check for multiple and type
gallery and playlist check for multiple and type, being gallery true when multiple is true and type is image, while playlist true when multiple is true and type is audio.
type check when setting the gallery property
The `gallery` property is set to `true` when `multiple` is `true` and `type === "image"`
double to single quotes
changed type check using single quotes instead of double quotes
@youknowriad

LGTM 👍

@youknowriad youknowriad merged commit d7eb4f6 into WordPress:master Aug 24, 2018

2 checks passed

codecov/project 50.61% (-0.23%) compared to adf84a4
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment