File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import classnames from 'classnames';
99import { addFilter } from '@wordpress/hooks' ;
1010import { __ } from '@wordpress/i18n' ;
1111import { createHigherOrderComponent } from '@wordpress/compose' ;
12+ import { useState } from '@wordpress/element' ;
1213
1314/**
1415 * Internal dependencies
@@ -48,8 +49,18 @@ export function BorderColorEdit( props ) {
4849 const colors = useSetting ( 'color.palette' ) || EMPTY_ARRAY ;
4950 const disableCustomColors = ! useSetting ( 'color.custom' ) ;
5051 const disableCustomGradients = ! useSetting ( 'color.customGradient' ) ;
52+ const [ colorValue , setColorValue ] = useState (
53+ ( ) =>
54+ getColorObjectByAttributeValues (
55+ colors ,
56+ borderColor ,
57+ style ?. border ?. color
58+ ) ?. color
59+ ) ;
5160
5261 const onChangeColor = ( value ) => {
62+ setColorValue ( value ) ;
63+
5364 const colorObject = getColorObjectByColorValue ( colors , value ) ;
5465 const newStyle = {
5566 ...style ,
@@ -71,7 +82,7 @@ export function BorderColorEdit( props ) {
7182 return (
7283 < ColorGradientControl
7384 label = { __ ( 'Color' ) }
74- value = { borderColor || style ?. border ?. color }
85+ colorValue = { colorValue }
7586 colors = { colors }
7687 gradients = { undefined }
7788 disableCustomColors = { disableCustomColors }
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ export default function BorderPanel( {
123123 { hasBorderColor && (
124124 < ColorGradientControl
125125 label = { __ ( 'Color' ) }
126- value = { borderColor }
126+ colorValue = { borderColor }
127127 colors = { colors }
128128 gradients = { undefined }
129129 disableCustomColors = { disableCustomColors }
You can’t perform that action at this time.
0 commit comments