From afc05832b27b6e718a8fa0b8fb8fe30f35e0823d Mon Sep 17 00:00:00 2001 From: Tejas-Raj01 Date: Sat, 27 Jun 2026 23:21:53 +0530 Subject: [PATCH 1/2] Fix: Prevent Tiled Gallery crash and add changelog entry (#49606) --- .../jetpack/changelog/fix-tiled-gallery-crash | 4 ++++ .../extensions/blocks/tiled-gallery/editor.js | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/fix-tiled-gallery-crash diff --git a/projects/plugins/jetpack/changelog/fix-tiled-gallery-crash b/projects/plugins/jetpack/changelog/fix-tiled-gallery-crash new file mode 100644 index 000000000000..d96772ef47c6 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-tiled-gallery-crash @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Tiled Gallery: prevent editor crash when transforming a core gallery block. diff --git a/projects/plugins/jetpack/extensions/blocks/tiled-gallery/editor.js b/projects/plugins/jetpack/extensions/blocks/tiled-gallery/editor.js index f05ed8021509..597212f4e8c4 100644 --- a/projects/plugins/jetpack/extensions/blocks/tiled-gallery/editor.js +++ b/projects/plugins/jetpack/extensions/blocks/tiled-gallery/editor.js @@ -69,7 +69,7 @@ const exampleAttributes = { * @param {Array} images - Array of image objects * @return {Array} Array of image objects which have id and url */ -function getValidImages( images ) { +function getValidImages( images = [] ) { return images.filter( ( { id, url } ) => id && url ); } registerJetpackBlockFromMetadata( metadata, { @@ -98,7 +98,17 @@ registerJetpackBlockFromMetadata( metadata, { { type: 'block', blocks: [ 'core/gallery', 'jetpack/slideshow' ], - transform: ( { images } ) => { + transform: ( { images = [] }, innerBlocks ) => { + if ( ! images.length && innerBlocks?.length ) { + images = innerBlocks + .filter( b => b.name === 'core/image' && b.attributes?.url ) + .map( ( { attributes } ) => ( { + id: attributes.id, + url: attributes.url, + link: attributes.link, + alt: attributes.alt, + } ) ); + } const validImages = getValidImages( images ); if ( validImages.length > 0 ) { return createBlock( metadata.name, { From 894966c7d10769c8492a020ea15f62c9663740f2 Mon Sep 17 00:00:00 2001 From: Tejas-Raj01 Date: Fri, 3 Jul 2026 15:49:03 +0530 Subject: [PATCH 2/2] Fix: Update image extraction to use href instead of link for core/image compatibility --- .../plugins/jetpack/extensions/blocks/tiled-gallery/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/plugins/jetpack/extensions/blocks/tiled-gallery/editor.js b/projects/plugins/jetpack/extensions/blocks/tiled-gallery/editor.js index 597212f4e8c4..4bc8a8d6a662 100644 --- a/projects/plugins/jetpack/extensions/blocks/tiled-gallery/editor.js +++ b/projects/plugins/jetpack/extensions/blocks/tiled-gallery/editor.js @@ -105,7 +105,7 @@ registerJetpackBlockFromMetadata( metadata, { .map( ( { attributes } ) => ( { id: attributes.id, url: attributes.url, - link: attributes.link, + link: attributes.href, alt: attributes.alt, } ) ); }