Skip to content

Commit 87e4d84

Browse files
committed
update selector callback
1 parent 7d01e08 commit 87e4d84

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/block/posts/style.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -281,26 +281,13 @@ Image.addStyles( blockStyles, {
281281
const blockStyle = getBlockStyle( variations, className )
282282
return ! [ 'list', 'horizontal', 'horizontal-2', 'portfolio', 'portfolio-2', 'vertical-card-2' ].includes( blockStyle?.name )
283283
},
284-
saveEnableWidthCallback: getAttribute => {
285-
const className = getAttribute( 'className' )
286-
const imageHasLink = getAttribute( 'imageHasLink' )
287-
const blockStyle = getBlockStyle( variations, className )
288-
289-
if ( [ 'horizontal', 'horizontal-2' ].includes( blockStyle?.name ) ) {
290-
if ( imageHasLink ) {
291-
return false
292-
}
293-
return true
294-
}
295-
return true
296-
},
297284
selectorCallback: ( getAttribute, _attributes, _clientId, props ) => {
298285
const className = getAttribute( 'className' )
299286
const blockStyle = getBlockStyle( variations, className )
300287
const imageHasLink = getAttribute( 'imageHasLink' )
301288

302289
const selector = props.selector
303-
if ( [ 'list' ].includes( blockStyle?.name ) && imageHasLink ) {
290+
if ( [ 'list', 'horizontal', 'horizontal-2' ].includes( blockStyle?.name ) && imageHasLink ) {
304291
return Array.isArray( selector )
305292
? [ ...selector, `${ itemSelector } .stk-block-posts__image-link` ]
306293
: [ selector, `${ itemSelector } .stk-block-posts__image-link` ]
@@ -312,7 +299,7 @@ Image.addStyles( blockStyles, {
312299
const blockStyle = getBlockStyle( variations, className )
313300
const imageHasLink = getAttribute( 'imageHasLink' )
314301

315-
if ( [ 'list' ].includes( blockStyle?.name ) && imageHasLink ) {
302+
if ( [ 'list', 'horizontal', 'horizontal-2' ].includes( blockStyle?.name ) && imageHasLink ) {
316303
return 'flexBasis'
317304
}
318305
return 'width'

0 commit comments

Comments
 (0)