Skip to content

Commit 8d9cbdf

Browse files
fix (migration): do not re-migrate button gradient color if it's already migrated before. 3rd take
1 parent 01d2cad commit 8d9cbdf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/block-components/button/deprecated.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,20 @@ export const deprecateButtonGradientColor = {
5454
const color2ParentHover = getAttribute( 'backgroundColor2ParentHover' ) || color1ParentHover
5555
const gradientDirectionParentHover = getAttribute( 'backgroundGradientDirectionParentHover' ) || getAttribute( 'backgroundGradientDirectionParentHover' ) === 0 ? getAttribute( 'backgroundGradientDirectionParentHover' ) : 90
5656

57-
const isColor1Gradient = color1 && color1.includes( 'linear-gradient' )
58-
const isColor2Gradient = color2 && color2.includes( 'linear-gradient' )
57+
const isColor1Gradient = color1 && color1.includes( '-gradient' )
58+
const isColor2Gradient = color2 && color2.includes( '-gradient' )
5959
if ( color1 && color2 && ! isColor1Gradient && ! isColor2Gradient ) {
6060
newAttributes[ getAttrName( 'backgroundColor' ) ] = `linear-gradient(${ gradientDirection }deg, ${ color1 } 0%, ${ color2 } 100%)`
6161
}
6262

63-
const isColor1HoverGradient = color1Hover && color1Hover.includes( 'linear-gradient' )
64-
const isColor2HoverGradient = color2Hover && color2Hover.includes( 'linear-gradient' )
63+
const isColor1HoverGradient = color1Hover && color1Hover.includes( '-gradient' )
64+
const isColor2HoverGradient = color2Hover && color2Hover.includes( '-gradient' )
6565
if ( color1Hover && color2Hover && ! isColor1HoverGradient && ! isColor2HoverGradient ) {
6666
newAttributes[ getAttrName( 'backgroundColorHover' ) ] = `linear-gradient(${ gradientDirectionHover }deg, ${ color1Hover } 0%, ${ color2Hover } 100%)`
6767
}
6868

69-
const isColor1ParentHoverGradient = color1ParentHover && color1ParentHover.includes( 'linear-gradient' )
70-
const isColor2ParentHoverGradient = color2ParentHover && color2ParentHover.includes( 'linear-gradient' )
69+
const isColor1ParentHoverGradient = color1ParentHover && color1ParentHover.includes( '-gradient' )
70+
const isColor2ParentHoverGradient = color2ParentHover && color2ParentHover.includes( '-gradient' )
7171
if ( color1ParentHover && color2ParentHover && ! isColor1ParentHoverGradient && ! isColor2ParentHoverGradient ) {
7272
newAttributes[ getAttrName( 'backgroundColorParentHover' ) ] = `linear-gradient(${ gradientDirectionParentHover }deg, ${ color1ParentHover } 0%, ${ color2ParentHover } 100%)`
7373
}

0 commit comments

Comments
 (0)