Skip to content

fix: preserve all images in column block cells with multiple images#926

Open
kptdobe wants to merge 1 commit intomainfrom
multiimg
Open

fix: preserve all images in column block cells with multiple images#926
kptdobe wants to merge 1 commit intomainfrom
multiimg

Conversation

@kptdobe
Copy link
Copy Markdown
Contributor

@kptdobe kptdobe commented May 8, 2026

Issue

Customer reported only first image of each column in a column block with a lot of images in each column are not visible in the preview box.

See:
Before: https://main--da-live--adobe.aem.live/edit#/kptdobe/daplayground/images
After: https://multiimg--da-live--adobe.aem.live/edit#/kptdobe/daplayground/images

Just open the preview window.

Summary

  • makePictures in prose2aem.js was replacing the entire <p> element with the first image's <picture> whenever the <p> was the sole child of its grandparent — even when that <p> contained multiple <img> tags
  • The remaining sibling images were orphaned and lost, leaving only 1 image per column in a columns block
  • Fix: added imgParent.childElementCount === 1 guard so the <p>-unwrap only fires when the <p> holds exactly one image

Test plan

  • New failing test added: Preserves all images in each column when a column block has 3 columns with multiple images per column
  • Test confirms bug (1 picture per column instead of 3) before fix, passes after
  • All existing prose2aem tests continue to pass (no regressions)
  • Run npm test — 1314 passed, 0 failed

🤖 Generated with Claude Code

When a <p> containing multiple <img> tags was the sole child of its
parent, makePictures replaced the entire <p> with only the first
image's <picture>, orphaning the rest. Adding childElementCount === 1
guard on the <p> ensures the unwrap only fires for single-image cells.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented May 8, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants