Skip to content

Commit

Permalink
Use external image decoration from assets plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Satya Deep Maheshwari committed Dec 8, 2024
1 parent e98649d commit 08d9df9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion scripts/aem-assets-plugin-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ const blocks = ['video'];

// Initialize the aem-assets-plugin.
export default async function assetsInit() {
const { loadBlock, createOptimizedPicture } = await import(`${codeBasePath}/scripts/aem-assets.js`);
const { loadBlock, createOptimizedPicture, decorateExternalImages, decorateImagesFromAlt } = await import(`${codeBasePath}/scripts/aem-assets.js`);

Check failure on line 9 in scripts/aem-assets-plugin-support.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break after this opening brace

Check failure on line 9 in scripts/aem-assets-plugin-support.js

View workflow job for this annotation

GitHub Actions / build

Expected a line break before this closing brace
window.hlx = window.hlx || {};
window.hlx.aemassets = {
codeBasePath,
blocks,
loadBlock,
createOptimizedPicture,
decorateExternalImages,
decorateImagesFromAlt,
};
}
7 changes: 4 additions & 3 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,14 @@ function decorateDeliveryImages(main) {
// eslint-disable-next-line import/prefer-default-export
export function decorateMain(main) {
// decorate external images with explicit external image marker
decorateExternalImages(main, '//External Image//');
window.hlx?.aemassets?.decorateExternalImages(main, '//External Image//');

// decorate external images with implicit external image marker
decorateExternalImages(main);
window.hlx?.aemassets?.decorateExternalImages(main);

// decorate images with delivery url and correct alt text
decorateDeliveryImages(main);
window.hlx?.aemassets?.decorateImagesFromAlt(main);

// hopefully forward compatible button decoration
decorateButtons(main);
decorateIcons(main);
Expand Down

0 comments on commit 08d9df9

Please sign in to comment.