@@ -150,16 +150,15 @@ const Edit = ({
150150 isTablet = isPreviewTablet ;
151151 isMobile = isPreviewMobile ;
152152 }
153+ const { layout, layoutTablet, layoutMobile } = parentBlock . attributes ;
154+ const index = parentBlock . innerBlocks . findIndex ( i => i . clientId === clientId ) ;
155+ let { columns } = parentBlock . attributes ;
153156
154- if ( attributes . columnWidth === undefined ) {
155- const index = parentBlock . innerBlocks . findIndex ( i => i . clientId === clientId ) ;
156- let { columns } = parentBlock . attributes ;
157- const { layout } = parentBlock . attributes ;
158-
159- if ( 6 < columns ) {
160- columns = 6 ;
161- }
157+ if ( 6 < columns ) {
158+ columns = 6 ;
159+ }
162160
161+ if ( attributes . columnWidth === undefined ) {
163162 updateBlockAttributes ( clientId , {
164163 columnWidth : layouts [ columns ] [ layout ] [ index ]
165164 } ) ;
@@ -180,9 +179,18 @@ const Edit = ({
180179 marginLeft : getValue ( 'margin' ) ?. left
181180 } ;
182181
182+ if ( isDesktop ) {
183+ const desktopStyle = pickBy ( {
184+ flexBasis : `${ attributes . columnWidth } %` ,
185+ } , ( value ) => value ) ;
186+ stylesheet = merge ( stylesheet , desktopStyle ) ;
187+ }
183188
184189 if ( isTablet || isMobile ) {
190+ const flexBasis = layouts [ columns ] [ layoutTablet ] [ index ] ;
191+
185192 const tabletStyle = pickBy ( {
193+ flexBasis : `${ flexBasis } %` ,
186194 paddingTop : getValue ( 'paddingTablet' ) ?. top ,
187195 paddingRight : getValue ( 'paddingTablet' ) ?. right ,
188196 paddingBottom : getValue ( 'paddingTablet' ) ?. bottom ,
@@ -196,7 +204,10 @@ const Edit = ({
196204 }
197205
198206 if ( isMobile ) {
207+ const flexBasis = layouts [ columns ] [ layoutMobile ] [ index ] ;
208+
199209 const mobileStyle = pickBy ( {
210+ flexBasis : `${ flexBasis } %` ,
200211 paddingTop : getValue ( 'paddingMobile' ) ?. top ,
201212 paddingRight : getValue ( 'paddingMobile' ) ?. right ,
202213 paddingBottom : getValue ( 'paddingMobile' ) ?. bottom ,
@@ -265,7 +276,6 @@ const Edit = ({
265276 } ;
266277
267278 const style = {
268- flexBasis : `${ attributes . columnWidth } %` ,
269279 ...stylesheet ,
270280 ...background ,
271281 ...borderStyle ,
0 commit comments