Skip to content

Commit

Permalink
Merge pull request #558 from WordPress/remove/545-image-align-none
Browse files Browse the repository at this point in the history
Remove image block align none control
  • Loading branch information
aduth authored May 3, 2017
2 parents 142a20b + f78a16d commit cbfe372
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions blocks/library/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const { attr, children } = query;
* @param {string} align Alignment value
* @return {Function} Attribute setter
*/
function applyOrUnset( align ) {
function toggleAlignment( align ) {
return ( attributes, setAttributes ) => {
const nextAlign = attributes.align === align ? undefined : align;
setAttributes( { align: nextAlign } );
Expand All @@ -43,31 +43,25 @@ registerBlock( 'core/image', {
icon: 'align-left',
title: wp.i18n.__( 'Align left' ),
isActive: ( { align } ) => 'left' === align,
onClick: applyOrUnset( 'left' )
onClick: toggleAlignment( 'left' )
},
{
icon: 'align-center',
title: wp.i18n.__( 'Align center' ),
isActive: ( { align } ) => 'center' === align,
onClick: applyOrUnset( 'center' )
onClick: toggleAlignment( 'center' )
},
{
icon: 'align-right',
title: wp.i18n.__( 'Align right' ),
isActive: ( { align } ) => 'right' === align,
onClick: applyOrUnset( 'right' )
},
{
icon: 'align-none',
title: wp.i18n.__( 'No alignment' ),
isActive: ( { align } ) => ! align || 'none' === align,
onClick: applyOrUnset( 'none' )
onClick: toggleAlignment( 'right' )
},
{
icon: 'align-full-width',
title: wp.i18n.__( 'Wide width' ),
isActive: ( { align } ) => 'wide' === align,
onClick: applyOrUnset( 'wide' )
onClick: toggleAlignment( 'wide' )
}
],

Expand Down

0 comments on commit cbfe372

Please sign in to comment.