@@ -4,7 +4,7 @@ import { attributes } from './schema'
44import { withVersion } from '~stackable/higher-order'
55import {
66 deprecateBlockBackgroundColorOpacity , deprecateContainerBackgroundColorOpacity , deprecateTypographyGradientColor ,
7- deprecateBlockShadowColor , deprecateContainerShadowColor ,
7+ deprecateBlockShadowColor , deprecateContainerShadowColor , deprecateTypographyFontSize ,
88} from '~stackable/block-components'
99import { createUniqueClass } from '~stackable/util'
1010
@@ -68,6 +68,66 @@ const getEquivalentIconSize = iconSize => {
6868}
6969
7070const deprecated = [
71+ {
72+ // Support the new shadow color.
73+ attributes : attributes ( '3.15.2' ) ,
74+ save : withVersion ( '3.15.2' ) ( Save ) ,
75+ isEligible : attributes => {
76+ return deprecateTypographyFontSize . isEligible ( '%s' ) ( attributes )
77+ } ,
78+ supports : {
79+ anchor : true ,
80+ spacing : true ,
81+ __unstablePasteTextInline : true ,
82+ __experimentalSelector : 'ol,ul' ,
83+ __experimentalOnMerge : true ,
84+ } ,
85+ migrate : ( attributes , innerBlocks ) => {
86+ let newAttributes = { ...attributes }
87+ const {
88+ text, icons, iconSize, ordered, iconGap,
89+ } = attributes
90+
91+ const _iconSize = iconSize ? iconSize : 1
92+ const _iconGap = iconGap ? iconGap : 0
93+
94+ newAttributes = {
95+ ...newAttributes ,
96+ listFullWidth : false ,
97+ iconVerticalAlignment : 'baseline' ,
98+ iconGap : _iconGap + 4 , // Our gap is smaller now.
99+ iconSize : ordered
100+ ? getEquivalentFontSize ( _iconSize )
101+ : getEquivalentIconSize ( _iconSize ) ,
102+ }
103+
104+ if ( ! text ) {
105+ const block = createBlock ( 'stackable/icon-list-item' )
106+ innerBlocks = [ block ]
107+ } else {
108+ const contents = textToArray ( text )
109+ const blocks = contents . map ( ( content , index ) => {
110+ const newBlock = createBlock ( 'stackable/icon-list-item' , {
111+ text : content ,
112+ icon : getUniqueIcon ( icons , index ) ,
113+ } )
114+ newBlock . attributes . uniqueId = createUniqueClass ( newBlock . clientId )
115+
116+ return newBlock
117+ } )
118+ innerBlocks = blocks
119+ }
120+
121+ newAttributes = deprecateContainerBackgroundColorOpacity . migrate ( newAttributes )
122+ newAttributes = deprecateBlockBackgroundColorOpacity . migrate ( newAttributes )
123+ newAttributes = deprecateTypographyGradientColor . migrate ( '%s' ) ( newAttributes )
124+ newAttributes = deprecateBlockShadowColor . migrate ( newAttributes )
125+ newAttributes = deprecateContainerShadowColor . migrate ( newAttributes )
126+ newAttributes = deprecateTypographyFontSize . migrate ( '%s' ) ( newAttributes )
127+
128+ return [ newAttributes , innerBlocks ]
129+ } ,
130+ } ,
71131 {
72132 // Support the new shadow color.
73133 attributes : attributes ( '3.12.11' ) ,
0 commit comments