Skip to content

Commit

Permalink
Remove edit gallery toolbar button
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Aug 8, 2019
1 parent 1c77941 commit bdece04
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions packages/block-library/src/gallery/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@ import { filter, forEach, map, find, every } from 'lodash';
*/
import { compose } from '@wordpress/compose';
import {
IconButton,
PanelBody,
RangeControl,
SelectControl,
ToggleControl,
Toolbar,
withNotices,
} from '@wordpress/components';
import {
BlockControls,
BlockIcon,
MediaPlaceholder,
MediaUpload,
InspectorControls,
} from '@wordpress/block-editor';
import { Component } from '@wordpress/element';
Expand Down Expand Up @@ -243,30 +239,6 @@ class GalleryEdit extends Component {

const hasImages = !! images.length;

const controls = (
<BlockControls>
{ hasImages && (
<Toolbar>
<MediaUpload
onSelect={ this.onSelectImages }
allowedTypes={ ALLOWED_MEDIA_TYPES }
multiple
gallery
value={ images.map( ( img ) => img.id ) }
render={ ( { open } ) => (
<IconButton
className="components-toolbar__control"
label={ __( 'Edit gallery' ) }
icon="edit"
onClick={ open }
/>
) }
/>
</Toolbar>
) }
</BlockControls>
);

const mediaPlaceholder = (
<MediaPlaceholder
addToGallery={ hasImages }
Expand All @@ -289,17 +261,11 @@ class GalleryEdit extends Component {
);

if ( ! hasImages ) {
return (
<>
{ controls }
{ mediaPlaceholder }
</>
);
return mediaPlaceholder;
}

return (
<>
{ controls }
<InspectorControls>
<PanelBody title={ __( 'Gallery Settings' ) }>
{ images.length > 1 && <RangeControl
Expand Down

0 comments on commit bdece04

Please sign in to comment.