Skip to content

Commit 08d9df9

Browse files
author
Satya Deep Maheshwari
committed
Use external image decoration from assets plugin
1 parent e98649d commit 08d9df9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

scripts/aem-assets-plugin-support.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ const blocks = ['video'];
66

77
// Initialize the aem-assets-plugin.
88
export default async function assetsInit() {
9-
const { loadBlock, createOptimizedPicture } = await import(`${codeBasePath}/scripts/aem-assets.js`);
9+
const { loadBlock, createOptimizedPicture, decorateExternalImages, decorateImagesFromAlt } = await import(`${codeBasePath}/scripts/aem-assets.js`);
1010
window.hlx = window.hlx || {};
1111
window.hlx.aemassets = {
1212
codeBasePath,
1313
blocks,
1414
loadBlock,
1515
createOptimizedPicture,
16+
decorateExternalImages,
17+
decorateImagesFromAlt,
1618
};
1719
}

scripts/scripts.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,14 @@ function decorateDeliveryImages(main) {
243243
// eslint-disable-next-line import/prefer-default-export
244244
export function decorateMain(main) {
245245
// decorate external images with explicit external image marker
246-
decorateExternalImages(main, '//External Image//');
246+
window.hlx?.aemassets?.decorateExternalImages(main, '//External Image//');
247247

248248
// decorate external images with implicit external image marker
249-
decorateExternalImages(main);
249+
window.hlx?.aemassets?.decorateExternalImages(main);
250250

251251
// decorate images with delivery url and correct alt text
252-
decorateDeliveryImages(main);
252+
window.hlx?.aemassets?.decorateImagesFromAlt(main);
253+
253254
// hopefully forward compatible button decoration
254255
decorateButtons(main);
255256
decorateIcons(main);

0 commit comments

Comments
 (0)