-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathdeprecated.js
More file actions
48 lines (40 loc) · 1.37 KB
/
deprecated.js
File metadata and controls
48 lines (40 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Save } from './save'
import { attributes } from './schema'
import { withVersion } from '~stackable/higher-order'
import {
deprecateBlockShadowColor, deprecateContainerShadowColor, Typography,
} from '~stackable/block-components'
import { semverCompare } from '~stackable/util'
import { addFilter } from '@wordpress/hooks'
// Change tag from <span> to <p> to inherit theme link styles.
addFilter( 'stackable.icon-list-item.save.typography.content', 'stackable/inheritThemeLinkStyles', ( output, props, attrs, textClassNames ) => {
if ( semverCompare( props.version, '<=', '3.15.3' ) ) {
return (
<Typography.Content
attributes={ attrs }
className={ textClassNames }
tagName="span"
/>
)
}
return output
} )
const deprecated = [
{
// Support the new shadow color.
attributes: attributes( '3.12.11' ),
save: withVersion( '3.12.11' )( Save ),
isEligible: attributes => {
const hasBlockShadow = deprecateBlockShadowColor.isEligible( attributes )
const hasContainerShadow = deprecateContainerShadowColor.isEligible( attributes )
return hasBlockShadow || hasContainerShadow
},
migrate: attributes => {
let newAttributes = { ...attributes }
newAttributes = deprecateBlockShadowColor.migrate( newAttributes )
newAttributes = deprecateContainerShadowColor.migrate( newAttributes )
return newAttributes
},
},
]
export default deprecated