Handle image updates in scripts/editor-support.js

Import decorateLinkedPictures from scripts.js:

import { decorateButtons, decorateMain, decorateLinkedPictures } from './scripts.js';

In applyChanges(), call decorateLinkedPictures on the updated content before decorating it.

  • Block branch: Call decorateLinkedPictures(newBlock) before decorateButtons(newBlock).
  • Section branch: Call decorateLinkedPictures(newSection) before decorateButtons(newSection).
  • Default-content branch: Call newElements.forEach((el) => decorateLinkedPictures(el)) before element.replaceWith(...newElements).

Preserve AEM Assets delivery URLs

Blocks that pass images through createOptimizedPicture must skip images served from another origin. The site cannot resize AEM Assets delivery-tier URLs.

For example, in blocks/cards/cards.js, update the image processing code as follows:

ul.querySelectorAll('picture > img').forEach((img) => {
  if (new URL(img.src, window.location.href).origin !== window.location.origin) return;
  const optimizedPic = createOptimizedPicture(img.src, img.alt, false, [{ width: '750' }]);
  moveInstrumentation(img, optimizedPic.querySelector('img'));
  img.closest('picture').replaceWith(optimizedPic);
});

Apply the same origin check to any custom block that calls createOptimizedPicture on authored images.

Use Coworker to find and replace images

Now that you have completed the required steps, content authors can use Coworker in the Universal Editor side panel to find and replace an image in a selected component.

Announcements

Get hands-on with agentic AI.

Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.

Find an event

Ask AI

Not sure where to start?
Ask me anything about Adobe products.

Type your question or pick a suggestion below.

Use of this AI chatbot is subject to Adobe's Privacy Policy. Don't share sensitive data. AI responses are not your Content, may be inaccurate, and any offers provided are non-binding. Generative AI Terms.

Ask AI