Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/block-components/typography/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ export const Controls = props => {

const onChangeContent = useCallback( text => setDebouncedText( escapeHTML( text ) ), [] )

// OceanWP compatibility.
// If OceanWP theme is used, initially use the theme's margin to follow its layout
useEffect( () => {
if ( hasRemoveMargins ) {
const value = getAttribute( 'useThemeTextMargins' )
updateAttribute( 'useThemeTextMargins', applyFilters( 'stackable.heading.edit.useThemeTextMargins', value ) )
}
}, [] )

return (
<>
{ applyFilters( 'stackable.block-component.typography.before', null, props ) }
Expand Down
1 change: 1 addition & 0 deletions src/compatibility/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import './kadence-theme'
import './wp-6-2'
import './oceanwp'
26 changes: 26 additions & 0 deletions src/compatibility/oceanwp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* OceanWP compatibility.
*/

/**
* External dependencies
*/
import { currentTheme } from 'stackable'

/**
* WordPress dependencies
*/
import { addFilter } from '@wordpress/hooks'

addFilter( 'stackable.heading.edit.useThemeTextMargins', 'stackable/compatibility/oceanwp', value => {
if ( currentTheme !== 'oceanwp' ) {
return value
}

// If no value has been set, default to true to use OceanWP margins
if ( value === '' ) {
return true
}

return value
} )
Loading