Skip to content

Commit

Permalink
GalleryBlock: place edit button in separate toolbar.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias committed Jun 12, 2017
1 parent 224e5ff commit 213e75a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions blocks/library/gallery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
import { __ } from 'i18n';
import './style.scss';
import { registerBlockType, query as hpq } from '../../api';
import { Fill } from 'react-slot-fill';

/**
* WordPress dependencies
*/
import { Toolbar, Placeholder } from 'components';

import Placeholder from 'components/placeholder';
import MediaUploadButton from '../../media-upload-button';
import InspectorControls from '../../inspector-controls';

Expand Down Expand Up @@ -104,11 +109,6 @@ registerBlockType( 'core/gallery', {
isActive: ( { align } ) => 'full' === align,
onClick: toggleAlignment( 'full' ),
},
{
icon: 'format-image',
title: wp.i18n.__( 'Edit Gallery' ),
onClick: editMediaLibrary,
},
],

getEditWrapperProps( attributes ) {
Expand Down Expand Up @@ -144,6 +144,13 @@ registerBlockType( 'core/gallery', {

return (
<div className={ `blocks-gallery align${ align } columns-${ columns }` }>
<Fill name="Formatting.Toolbar">
<Toolbar controls={ [ {
icon: 'format-image',
title: __( 'Edit Gallery' ),
onClick: () => editMediaLibrary( attributes, setAttributes ),
} ] } />
</Fill>
{ images.map( ( img ) => (
<GalleryImage key={ img.url } img={ img } />
) ) }
Expand Down

0 comments on commit 213e75a

Please sign in to comment.