Product Gallery: Fix justification not saving correctly (https://github.com/woocommerce/woocommerce-blocks/pull/11324)
This commit is contained in:
parent
d6df0d451b
commit
b87aafebe0
|
@ -140,6 +140,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 ) {
|
||||
|
@ -182,6 +186,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' ) &&
|
||||
|
|
Loading…
Reference in New Issue