Skip to content

Commit

Permalink
Use value to disable for existing galleries
Browse files Browse the repository at this point in the history
`addToGallery` is not used by all gallery-type blocks, like tiled-gallery or slideshow.

Props @jeherve.
  • Loading branch information
obenland committed Jun 24, 2020
1 parent 6b74c18 commit d2c4f68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/shared/external-media/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ if ( isCurrentUserConnected() ) {
'editor.MediaUpload',
'external-media/replace-media-upload',
OriginalComponent => props => {
const { addToGallery = false, allowedTypes } = props;
const { allowedTypes, gallery = false, value = false } = props;
let { render } = props;

// Only replace button for components that expect images, except existing galleries.
if ( allowedTypes.indexOf( 'image' ) > -1 && ! addToGallery ) {
if ( allowedTypes.indexOf( 'image' ) > -1 && ! ( gallery && value ) ) {
render = button => <MediaButton { ...button } mediaProps={ props } />;
}

Expand Down

0 comments on commit d2c4f68

Please sign in to comment.