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

GalleryBlock: place edit button in separate toolbar. #1136

Merged
merged 2 commits into from
Jun 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 'edit',
title: __( 'Edit Gallery' ),
onClick: () => editMediaLibrary( attributes, setAttributes ),
} ] } />
</Fill>
{ images.map( ( img ) => (
<GalleryImage key={ img.url } img={ img } />
) ) }
Expand Down