File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,11 +67,25 @@ const BootstrapButtonEdit = ( {
6767 } ;
6868
6969 // Fill empty color values with default values and check for usage of deprecated color attribute in styleOptions
70- const styleOptionsWithDefault = styleOptions . map ( ( styleOption ) => ( {
71- ...styleOption ,
72- textColor : styleOption . textColor || DEFAULT_TEXT_COLOR ,
73- bgColor : styleOption . bgColor || styleOption . color || DEFAULT_BG_COLOR , // Fallback to deprecated color attribute
74- } ) ) ;
70+ let hasDeprecatedColorAttributes = false ;
71+ const styleOptionsWithDefault = styleOptions . map ( ( styleOption ) => {
72+ if ( styleOption . color ) {
73+ hasDeprecatedColorAttributes = true ;
74+ }
75+ return {
76+ ...styleOption ,
77+ textColor : styleOption . textColor || DEFAULT_TEXT_COLOR ,
78+ bgColor :
79+ styleOption . bgColor || styleOption . color || DEFAULT_BG_COLOR , // Fallback to deprecated color attribute
80+ } ;
81+ } ) ;
82+
83+ if ( hasDeprecatedColorAttributes ) {
84+ // eslint-disable-next-line no-console
85+ console . warn (
86+ '[wpBootstrapBlocks.button.styleOptions filter] The color attribute in styleOptions is deprecated. Please us bgColor and textColor instead.'
87+ ) ;
88+ }
7589
7690 // Prepare CSS rules for selected button style
7791 let inlineStyle = {
You can’t perform that action at this time.
0 commit comments