Skip to content

Commit f74f44e

Browse files
authored
fix (columns block): fix columns justify when wrapping is enabled (#3703)
1 parent 98e1d99 commit f74f44e

4 files changed

Lines changed: 23 additions & 2 deletions

File tree

src/block/columns/deprecated.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,23 @@ addFilter( 'stackable.columns.save.contentClassNames', 'stackable/3.8.0', ( clas
3636
return classes
3737
} )
3838

39+
// Column wrapping now adds the stk--column-wrap-desktop class.
40+
addFilter( 'stackable.columns.save.contentClassNames', 'stackable/3.19.8', ( classes, props ) => {
41+
if ( semverCompare( props.version, '<', '3.19.8' ) ) {
42+
return classes.filter( className => {
43+
return ! className?.[ 'stk--column-wrap-desktop' ]
44+
} )
45+
}
46+
47+
return classes
48+
} )
49+
3950
const deprecated = [
51+
{
52+
// Support Columns blocks saved before the column wrapping marker was added.
53+
attributes: attributes( '3.19.7' ),
54+
save: withVersion( '3.19.7' )( Save ),
55+
},
4056
{
4157
// Handle the migration of shadow attributes with the change of type in 3.15.3
4258
attributes: attributes( '3.16.2' ),

src/block/columns/edit.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ const Edit = props => {
9191
'stk-inner-blocks',
9292
blockAlignmentClass,
9393
'stk-block-content',
94-
], getContentAlignmentClasses( props.attributes, 'column', instanceId ) )
94+
], {
95+
'stk--column-wrap-desktop': props.attributes.columnWrapDesktop,
96+
}, getContentAlignmentClasses( props.attributes, 'column', instanceId ) )
9597

9698
// Generate the CSS styles for the block.
9799
const blockCss = useBlockCssGenerator( {

src/block/columns/save.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ export const Save = props => {
4545
blockAlignmentClass,
4646
'stk-block-content',
4747
],
48+
{
49+
'stk--column-wrap-desktop': attributes.columnWrapDesktop,
50+
},
4851
getContentAlignmentClasses( props.attributes ),
4952
], props ) )
5053

src/block/columns/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import "common";
22
@import "./deprecated-style";
33

4-
.stk--flex > .stk-block-column {
4+
.stk--flex:not(.stk--column-wrap-desktop) > .stk-block-column {
55
width: fit-content;
66
flex: 0 1 auto !important;
77
min-width: 24px;

0 commit comments

Comments
 (0)