Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Product Gallery: Fix justification not saving correctly (#11324)
Browse files Browse the repository at this point in the history
  • Loading branch information
roykho authored Oct 20, 2023
1 parent 7ac0586 commit 43978d7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions assets/js/blocks/product-gallery/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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' ) &&
Expand Down

0 comments on commit 43978d7

Please sign in to comment.