Skip to content

Commit

Permalink
Block Supports: Use empty initial value for border-radius
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman committed May 4, 2021
1 parent 1be5eb4 commit 85860e5
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions packages/block-editor/src/hooks/border-radius.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 (
Expand All @@ -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 }
/>
Expand Down

0 comments on commit 85860e5

Please sign in to comment.