@@ -2,11 +2,47 @@ import { Save } from './save'
22import { attributes } from './schema'
33
44import { withVersion } from '~stackable/higher-order'
5+ import { semverCompare } from '~stackable/util'
56import {
7+ BlockDiv , CustomCSS , Button , Typography ,
68 deprecateBlockBackgroundColorOpacity , deprecateButtonGradientColor ,
79 deprecateContainerBackgroundColorOpacity , deprecateShadowColor ,
810 deprecateContainerShadowColor , deprecateBlockShadowColor ,
911} from '~stackable/block-components'
12+ import { addFilter } from '@wordpress/hooks'
13+ import { useBlockProps } from '@wordpress/block-editor'
14+
15+ // If button style is link, change BlockDiv tag from <div> to <p> to inherit theme link styles.
16+ addFilter ( 'stackable.button.save.blockDiv.content' , 'stackable/inheritThemeLinkStyles' , ( output , props , propsToPass , blockClassNames , customAttributes , typographyInnerClassNames ) => {
17+ if ( semverCompare ( props . version , '<' , '3.13.11' ) ) {
18+ return (
19+ < BlockDiv . Content
20+ { ...useBlockProps . save ( { className : blockClassNames } ) }
21+ attributes = { props . attributes }
22+ applyCustomAttributes = { false }
23+ version = { props . version }
24+ >
25+ { props . attributes . generatedCss && < style > { props . attributes . generatedCss } </ style > }
26+ < CustomCSS . Content attributes = { props . attributes } />
27+ < Button . Content
28+ { ...propsToPass }
29+ attributes = { props . attributes }
30+ buttonProps = { {
31+ id : props . attributes . anchorId || undefined ,
32+ ...customAttributes ,
33+ } }
34+ >
35+ < Typography . Content
36+ attributes = { props . attributes }
37+ tagName = "span"
38+ className = { typographyInnerClassNames }
39+ />
40+ </ Button . Content >
41+ </ BlockDiv . Content >
42+ )
43+ }
44+ return output
45+ } )
1046
1147const deprecated = [
1248 {
0 commit comments