From 85860e57833f07dfc4c520a493c7a58b1239a3f4 Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Tue, 4 May 2021 07:37:38 -0700 Subject: [PATCH] Block Supports: Use empty initial value for border-radius --- .../block-editor/src/hooks/border-radius.js | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/packages/block-editor/src/hooks/border-radius.js b/packages/block-editor/src/hooks/border-radius.js index 50e9dece97eaf..88cc36914ab7d 100644 --- a/packages/block-editor/src/hooks/border-radius.js +++ b/packages/block-editor/src/hooks/border-radius.js @@ -4,11 +4,6 @@ import { RangeControl } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -/** - * Internal dependencies - */ -import { cleanEmptyObject } from './utils'; - const MIN_BORDER_RADIUS_VALUE = 0; const MAX_BORDER_RADIUS_VALUE = 50; @@ -25,19 +20,15 @@ export function BorderRadiusEdit( props ) { } = props; const onChange = ( newRadius ) => { - let newStyle = { - ...style, - border: { - ...style?.border, - radius: newRadius, + setAttributes( { + style: { + ...style, + border: { + ...style?.border, + radius: newRadius, + }, }, - }; - - if ( newRadius === undefined ) { - newStyle = cleanEmptyObject( newStyle ); - } - - setAttributes( { style: newStyle } ); + } ); }; return ( @@ -46,7 +37,7 @@ export function BorderRadiusEdit( props ) { label={ __( 'Border radius' ) } min={ MIN_BORDER_RADIUS_VALUE } max={ MAX_BORDER_RADIUS_VALUE } - initialPosition={ 0 } + initialPosition="" allowReset onChange={ onChange } />