From 081dc50fb52d664b6067554109e59864706a2ab5 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 28 Apr 2017 14:22:00 -0400 Subject: [PATCH 1/2] Remove image block align none control --- blocks/library/image/index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/blocks/library/image/index.js b/blocks/library/image/index.js index 13ab903b179ae..8fac2aad8aaca 100644 --- a/blocks/library/image/index.js +++ b/blocks/library/image/index.js @@ -57,12 +57,6 @@ registerBlock( 'core/image', { isActive: ( { align } ) => 'right' === align, onClick: applyOrUnset( 'right' ) }, - { - icon: 'align-none', - title: wp.i18n.__( 'No alignment' ), - isActive: ( { align } ) => ! align || 'none' === align, - onClick: applyOrUnset( 'none' ) - }, { icon: 'align-full-width', title: wp.i18n.__( 'Wide width' ), From f78a16d9fe80fb0ad9147390d9181c3a44f45c92 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Wed, 3 May 2017 10:34:47 -0400 Subject: [PATCH 2/2] Rename applyOrUnset as toggleAlignment More accurately reflect toggle behavior --- blocks/library/image/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/blocks/library/image/index.js b/blocks/library/image/index.js index 8fac2aad8aaca..e63127968c592 100644 --- a/blocks/library/image/index.js +++ b/blocks/library/image/index.js @@ -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 } ); @@ -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' ) } ],