Skip to content

Commit

Permalink
Rename applyOrUnset as toggleAlignment
Browse files Browse the repository at this point in the history
More accurately reflect toggle behavior
  • Loading branch information
aduth committed May 3, 2017
1 parent 081dc50 commit f78a16d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 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,25 +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' )
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 f78a16d

Please sign in to comment.