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

Commit 43978d7

Browse files
authored
Product Gallery: Fix justification not saving correctly (#11324)
1 parent 7ac0586 commit 43978d7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

assets/js/blocks/product-gallery/utils.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ export const moveInnerBlocksToPosition = (
140140
const productGalleryBlock = getBlock( clientId );
141141

142142
if ( productGalleryBlock ) {
143+
const previousLayout = productGalleryBlock.innerBlocks.length
144+
? productGalleryBlock.innerBlocks[ 0 ].attributes.layout
145+
: null;
146+
143147
const thumbnailsBlock = findBlock( {
144148
blocks: [ productGalleryBlock ],
145149
findCondition( block ) {
@@ -182,6 +186,22 @@ export const moveInnerBlocksToPosition = (
182186
clientId
183187
);
184188

189+
setGroupBlockLayoutByThumbnailsPosition(
190+
thumbnailsPosition,
191+
productGalleryBlock.innerBlocks[ 0 ].clientId
192+
);
193+
194+
if ( previousLayout ) {
195+
const orientation =
196+
getGroupLayoutAttributes( thumbnailsPosition ).orientation;
197+
updateBlockAttributes(
198+
{
199+
layout: { ...previousLayout, orientation },
200+
},
201+
productGalleryBlock.innerBlocks[ 0 ]
202+
);
203+
}
204+
185205
if (
186206
( ( thumbnailsPosition === 'bottom' ||
187207
thumbnailsPosition === 'right' ) &&

0 commit comments

Comments
 (0)