From ed6e9d2021b2ffa84bb34988ca7a816e3eae1107 Mon Sep 17 00:00:00 2001 From: Gerardo Pacheco Date: Tue, 6 Jul 2021 17:02:48 +0200 Subject: [PATCH] Rename mergedStyle to style --- .../src/components/block-list/block.native.js | 2 +- .../block-library/src/button/edit.native.js | 17 ++++++++--------- .../block-library/src/columns/edit.native.js | 4 ++-- packages/block-library/src/group/edit.native.js | 8 ++++---- packages/block-library/src/heading/edit.js | 4 ++-- packages/block-library/src/list/edit.js | 4 ++-- .../block-library/src/media-text/edit.native.js | 7 +++---- .../block-library/src/paragraph/edit.native.js | 11 ++++------- packages/block-library/src/quote/edit.js | 4 ++-- packages/block-library/src/verse/edit.js | 4 ++-- 10 files changed, 30 insertions(+), 35 deletions(-) diff --git a/packages/block-editor/src/components/block-list/block.native.js b/packages/block-editor/src/components/block-list/block.native.js index 5e04046aaf0147..3f700ec22a2920 100644 --- a/packages/block-editor/src/components/block-list/block.native.js +++ b/packages/block-editor/src/components/block-list/block.native.js @@ -86,7 +86,7 @@ function BlockForType( { // Block level styles wrapperProps={ wrapperProps } // inherited styles merged with block level styles - mergedStyle={ mergedStyle } + style={ mergedStyle } clientId={ clientId } parentWidth={ parentWidth } contentStyle={ contentStyle } diff --git a/packages/block-library/src/button/edit.native.js b/packages/block-library/src/button/edit.native.js index f2d488e2714599..923ed47282efb8 100644 --- a/packages/block-library/src/button/edit.native.js +++ b/packages/block-library/src/button/edit.native.js @@ -184,7 +184,7 @@ class ButtonEdit extends Component { } getBackgroundColor() { - const { attributes, colors, gradients, mergedStyle } = this.props; + const { attributes, colors, gradients, style } = this.props; const { backgroundColor, gradient } = attributes; // Return named gradient value if available. @@ -207,13 +207,13 @@ class ButtonEdit extends Component { colorObject?.color || colorProps.style?.backgroundColor || colorProps.style?.background || - mergedStyle?.backgroundColor || + style?.backgroundColor || styles.defaultButton.backgroundColor ); } getTextColor() { - const { attributes, colors, mergedStyle } = this.props; + const { attributes, colors, style } = this.props; const colorProps = getColorClassesAndStyles( attributes ); // Retrieve named color object to force inline styles for themes that @@ -226,7 +226,7 @@ class ButtonEdit extends Component { return ( colorObject?.color || colorProps.style?.color || - mergedStyle?.color || + style?.color || styles.defaultButton.color ); } @@ -377,12 +377,12 @@ class ButtonEdit extends Component { mergeBlocks, parentWidth, setAttributes, - mergedStyle, + style, } = this.props; const { placeholder, text, - style, + style: buttonStyle, url, align = 'center', width, @@ -394,7 +394,7 @@ class ButtonEdit extends Component { return null; } - const borderRadius = style?.border?.radius; + const borderRadius = buttonStyle?.border?.radius; const borderRadiusValue = Number.isInteger( borderRadius ) ? borderRadius @@ -466,8 +466,7 @@ class ButtonEdit extends Component { } } textAlign={ align } placeholderTextColor={ - mergedStyle?.color || - styles.placeholderTextColor.color + style?.color || styles.placeholderTextColor.color } identifier="text" tagName="p" diff --git a/packages/block-library/src/columns/edit.native.js b/packages/block-library/src/columns/edit.native.js index 00b7e38e42c97e..40afe71538fdef 100644 --- a/packages/block-library/src/columns/edit.native.js +++ b/packages/block-library/src/columns/edit.native.js @@ -442,7 +442,7 @@ const ColumnsEditContainerWrapper = withDispatch( )( memo( ColumnsEditContainer ) ); const ColumnsEdit = ( props ) => { - const { clientId, isSelected, mergedStyle } = props; + const { clientId, isSelected, style } = props; const { columnCount, isDefaultColumns, @@ -505,7 +505,7 @@ const ColumnsEdit = ( props ) => { }, [] ); return ( - + diff --git a/packages/block-library/src/heading/edit.js b/packages/block-library/src/heading/edit.js index 0f8d900b62c4cf..023184969babd6 100644 --- a/packages/block-library/src/heading/edit.js +++ b/packages/block-library/src/heading/edit.js @@ -25,7 +25,7 @@ function HeadingEdit( { setAttributes, mergeBlocks, onReplace, - mergedStyle, + style, clientId, } ) { const { textAlign, content, level, placeholder } = attributes; @@ -34,7 +34,7 @@ function HeadingEdit( { className: classnames( { [ `has-text-align-${ textAlign }` ]: textAlign, } ), - style: mergedStyle, + style, } ); return ( diff --git a/packages/block-library/src/list/edit.js b/packages/block-library/src/list/edit.js index 15ed51bbb6fe15..8d39252aee128b 100644 --- a/packages/block-library/src/list/edit.js +++ b/packages/block-library/src/list/edit.js @@ -41,7 +41,7 @@ export default function ListEdit( { setAttributes, mergeBlocks, onReplace, - mergedStyle, + style, } ) { const { ordered, values, type, reversed, start, placeholder } = attributes; const tagName = ordered ? 'ol' : 'ul'; @@ -134,7 +134,7 @@ export default function ListEdit( { ); const blockProps = useBlockProps( { - style: mergedStyle, + style, } ); return ( diff --git a/packages/block-library/src/media-text/edit.native.js b/packages/block-library/src/media-text/edit.native.js index 77411cd81f8892..895dc40e7d7be1 100644 --- a/packages/block-library/src/media-text/edit.native.js +++ b/packages/block-library/src/media-text/edit.native.js @@ -254,7 +254,7 @@ class MediaTextEdit extends Component { setAttributes, isSelected, isRTL, - mergedStyle, + style, blockWidth, } = this.props; const { @@ -285,7 +285,7 @@ class MediaTextEdit extends Component { ? styles.innerBlockStackMediaLeft : styles.innerBlockStackMediaRight ), }, - ( mergedStyle?.backgroundColor || backgroundColor.color ) && + ( style?.backgroundColor || backgroundColor.color ) && styles.innerBlockPaddings, ]; @@ -302,8 +302,7 @@ class MediaTextEdit extends Component { ? styles[ 'is-stacked-on-mobile.has-media-on-the-right' ] : {} ), ...( isSelected && styles[ 'is-selected' ] ), - backgroundColor: - mergedStyle?.backgroundColor || backgroundColor.color, + backgroundColor: style?.backgroundColor || backgroundColor.color, paddingBottom: 0, }; diff --git a/packages/block-library/src/paragraph/edit.native.js b/packages/block-library/src/paragraph/edit.native.js index f71cc4279a2ef4..5bb6c32f8fea9d 100644 --- a/packages/block-library/src/paragraph/edit.native.js +++ b/packages/block-library/src/paragraph/edit.native.js @@ -19,7 +19,6 @@ function ParagraphBlock( { mergeBlocks, onReplace, setAttributes, - mergedStyle, style, clientId, } ) { @@ -30,13 +29,11 @@ function ParagraphBlock( { const { align, content, placeholder } = attributes; const styles = { - ...( mergedStyle?.baseColors && { - color: mergedStyle.baseColors?.color?.text, - placeholderColor: - mergedStyle.color || mergedStyle.baseColors?.color?.text, - linkColor: mergedStyle.baseColors?.elements?.link?.color?.text, + ...( style?.baseColors && { + color: style.baseColors?.color?.text, + placeholderColor: style.color || style.baseColors?.color?.text, + linkColor: style.baseColors?.elements?.link?.color?.text, } ), - ...mergedStyle, ...style, }; diff --git a/packages/block-library/src/quote/edit.js b/packages/block-library/src/quote/edit.js index ff0a8ac76d1a9e..1852f92e7e13f6 100644 --- a/packages/block-library/src/quote/edit.js +++ b/packages/block-library/src/quote/edit.js @@ -27,14 +27,14 @@ export default function QuoteEdit( { onReplace, className, insertBlocksAfter, - mergedStyle, + style, } ) { const { align, value, citation } = attributes; const blockProps = useBlockProps( { className: classnames( className, { [ `has-text-align-${ align }` ]: align, } ), - style: mergedStyle, + style, } ); return ( diff --git a/packages/block-library/src/verse/edit.js b/packages/block-library/src/verse/edit.js index 0f0f0b54078233..1ca846fb848b53 100644 --- a/packages/block-library/src/verse/edit.js +++ b/packages/block-library/src/verse/edit.js @@ -19,14 +19,14 @@ export default function VerseEdit( { setAttributes, mergeBlocks, onRemove, - mergedStyle, + style, } ) { const { textAlign, content } = attributes; const blockProps = useBlockProps( { className: classnames( { [ `has-text-align-${ textAlign }` ]: textAlign, } ), - style: mergedStyle, + style, } ); return (