File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed
block-components/typography Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,15 @@ export const Controls = props => {
100100
101101 const onChangeContent = useCallback ( text => setDebouncedText ( escapeHTML ( text ) ) , [ ] )
102102
103+ // OceanWP compatibility.
104+ // If OceanWP theme is used, initially use the theme's margin to follow its layout
105+ useEffect ( ( ) => {
106+ if ( hasRemoveMargins ) {
107+ const value = getAttribute ( 'useThemeTextMargins' )
108+ updateAttribute ( 'useThemeTextMargins' , applyFilters ( 'stackable.heading.edit.useThemeTextMargins' , value ) )
109+ }
110+ } , [ ] )
111+
103112 return (
104113 < >
105114 { applyFilters ( 'stackable.block-component.typography.before' , null , props ) }
Original file line number Diff line number Diff line change 11import './kadence-theme'
22import './wp-6-2'
3+ import './oceanwp'
Original file line number Diff line number Diff line change 1+ /**
2+ * Kadence Theme compatibility.
3+ */
4+
5+ /**
6+ * External dependencies
7+ */
8+ import { currentTheme } from 'stackable'
9+
10+ /**
11+ * WordPress dependencies
12+ */
13+ import { addFilter } from '@wordpress/hooks'
14+
15+ addFilter ( 'stackable.heading.edit.useThemeTextMargins' , 'stackable/compatibility/oceanwp' , value => {
16+ if ( currentTheme !== 'oceanwp' ) {
17+ return value
18+ }
19+
20+ // If no value has been set, default to true to use OceanWP margins
21+ if ( value === '' ) {
22+ return true
23+ }
24+
25+ return value
26+ } )
You can’t perform that action at this time.
0 commit comments