From d2633a12123fc85cc3cc2e87bcb8807edf3f618a Mon Sep 17 00:00:00 2001 From: Zebulan Stanphill Date: Mon, 7 Jan 2019 02:02:50 -0600 Subject: [PATCH] Cover block: use supports flag for block align (#10758) --- packages/block-library/src/cover/index.js | 31 ++++++++--------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/packages/block-library/src/cover/index.js b/packages/block-library/src/cover/index.js index 09df032d9418d..b1ceb293c336f 100644 --- a/packages/block-library/src/cover/index.js +++ b/packages/block-library/src/cover/index.js @@ -23,7 +23,6 @@ import { compose } from '@wordpress/compose'; import { BlockControls, InspectorControls, - BlockAlignmentToolbar, MediaPlaceholder, MediaUpload, MediaUploadCheck, @@ -34,8 +33,6 @@ import { getColorClassName, } from '@wordpress/editor'; -const validAlignments = [ 'left', 'center', 'right', 'wide', 'full' ]; - const blockAttributes = { title: { type: 'string', @@ -45,9 +42,6 @@ const blockAttributes = { url: { type: 'string', }, - align: { - type: 'string', - }, contentAlign: { type: 'string', default: 'center', @@ -92,6 +86,10 @@ export const settings = { attributes: blockAttributes, + supports: { + align: true, + }, + transforms: { from: [ { @@ -168,20 +166,12 @@ export const settings = { ], }, - getEditWrapperProps( attributes ) { - const { align } = attributes; - if ( -1 !== validAlignments.indexOf( align ) ) { - return { 'data-align': align }; - } - }, - edit: compose( [ withColors( { overlayColor: 'background-color' } ), withNotices, ] )( ( { attributes, setAttributes, isSelected, className, noticeOperations, noticeUI, overlayColor, setOverlayColor } ) => { const { - align, backgroundType, contentAlign, dimRatio, @@ -190,7 +180,6 @@ export const settings = { title, url, } = attributes; - const updateAlignment = ( nextAlign ) => setAttributes( { align: nextAlign } ); const onSelectMedia = ( media ) => { if ( ! media || ! media.url ) { setAttributes( { url: undefined, id: undefined } ); @@ -238,10 +227,6 @@ export const settings = { const controls = ( - { !! url && (