diff --git a/assets/js/blocks/product-gallery/utils.tsx b/assets/js/blocks/product-gallery/utils.tsx index a2e2b5ab307..5fdb4caf798 100644 --- a/assets/js/blocks/product-gallery/utils.tsx +++ b/assets/js/blocks/product-gallery/utils.tsx @@ -170,6 +170,10 @@ export const moveInnerBlocksToPosition = ( const productGalleryBlock = getBlock( clientId ); if ( productGalleryBlock ) { + const previousLayout = productGalleryBlock.innerBlocks.length + ? productGalleryBlock.innerBlocks[ 0 ].attributes.layout + : null; + const thumbnailsBlock = findBlock( { blocks: [ productGalleryBlock ], findCondition( block ) { @@ -212,6 +216,22 @@ export const moveInnerBlocksToPosition = ( clientId ); + setGroupBlockLayoutByThumbnailsPosition( + thumbnailsPosition, + productGalleryBlock.innerBlocks[ 0 ].clientId + ); + + if ( previousLayout ) { + const orientation = + getGroupLayoutAttributes( thumbnailsPosition ).orientation; + updateBlockAttributes( + { + layout: { ...previousLayout, orientation }, + }, + productGalleryBlock.innerBlocks[ 0 ] + ); + } + if ( ( ( thumbnailsPosition === 'bottom' || thumbnailsPosition === 'right' ) &&