From 4d0f8c29ec2e87fd896c42182bba313c9ee193f7 Mon Sep 17 00:00:00 2001 From: Alquen Antonio Sarmiento Date: Wed, 9 Oct 2024 15:46:47 +0800 Subject: [PATCH] fix(heading): heading v3 with less aggresive non use of theme margins --- src/block/heading/deprecated.js | 15 +++++++++++++++ src/block/heading/edit.js | 2 +- src/block/heading/save.js | 2 +- src/block/heading/style.scss | 7 +++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/block/heading/deprecated.js b/src/block/heading/deprecated.js index e8cc3be19..8075869ab 100644 --- a/src/block/heading/deprecated.js +++ b/src/block/heading/deprecated.js @@ -19,6 +19,21 @@ import { */ import { addFilter } from '@wordpress/hooks' +// Version 3.13.9 Deprecations +addFilter( 'stackable.heading.save.blockClassNames', 'stackable/3.13.9', ( output, props ) => { + if ( compareVersions( props.version, '3.13.9' ) >= 0 ) { // Current version is greater than or equal to 3.13.9 + return output + } + + const responsiveClass = getResponsiveClasses( props.attributes ) + return [ + props.className, + 'stk-block-heading', + responsiveClass, + 'stk-block-heading--v2', + ] +} ) + // Version 3.6.1 Deprecations addFilter( 'stackable.heading.save.blockClassNames', 'stackable/3.6.1', ( output, props ) => { if ( compareVersions( props.version, '3.6.1' ) === 1 ) { // Current version is greater than 3.6.1 diff --git a/src/block/heading/edit.js b/src/block/heading/edit.js index 3b0a4624d..bf66f249a 100644 --- a/src/block/heading/edit.js +++ b/src/block/heading/edit.js @@ -81,7 +81,7 @@ const Edit = props => { const blockClassNames = classnames( [ className, 'stk-block-heading', - 'stk-block-heading--v2', + 'stk-block-heading--v3', ] ) const textClassNames = classnames( [ diff --git a/src/block/heading/save.js b/src/block/heading/save.js index b5c9a632c..a79ec9148 100644 --- a/src/block/heading/save.js +++ b/src/block/heading/save.js @@ -33,7 +33,7 @@ export const Save = props => { className, 'stk-block-heading', responsiveClass, - 'stk-block-heading--v2', + 'stk-block-heading--v3', ], props ) ) const textClassNames = classnames( [ diff --git a/src/block/heading/style.scss b/src/block/heading/style.scss index 05a05cfaa..dca9da055 100644 --- a/src/block/heading/style.scss +++ b/src/block/heading/style.scss @@ -10,3 +10,10 @@ margin: 0 !important; } } + +.stk-block-heading--v3 { + .stk-block-heading__text:not(.stk-block-heading--use-theme-margins) { + margin-top: 0 !important; + margin-bottom: 0 !important; + } +}