Skip to content
Open
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
17 changes: 2 additions & 15 deletions src/block/posts/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,26 +281,13 @@ Image.addStyles( blockStyles, {
const blockStyle = getBlockStyle( variations, className )
return ! [ 'list', 'horizontal', 'horizontal-2', 'portfolio', 'portfolio-2', 'vertical-card-2' ].includes( blockStyle?.name )
},
saveEnableWidthCallback: getAttribute => {
const className = getAttribute( 'className' )
const imageHasLink = getAttribute( 'imageHasLink' )
const blockStyle = getBlockStyle( variations, className )

if ( [ 'horizontal', 'horizontal-2' ].includes( blockStyle?.name ) ) {
if ( imageHasLink ) {
return false
}
return true
}
return true
},
selectorCallback: ( getAttribute, _attributes, _clientId, props ) => {
const className = getAttribute( 'className' )
const blockStyle = getBlockStyle( variations, className )
const imageHasLink = getAttribute( 'imageHasLink' )

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

if ( [ 'list' ].includes( blockStyle?.name ) && imageHasLink ) {
if ( [ 'list', 'horizontal', 'horizontal-2' ].includes( blockStyle?.name ) && imageHasLink ) {
return 'flexBasis'
}
return 'width'
Expand Down
Loading