Skip to content

Commit

Permalink
Support AEM Asset alt text (description)
Browse files Browse the repository at this point in the history
  • Loading branch information
auniverseaway committed Jan 24, 2025
1 parent 5d3d395 commit 9450f85
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blocks/edit/da-assets/da-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ export async function openAssets() {
const { state } = view;
dialog.close();

// eslint-disable-next-line no-underscore-dangle
const alt = asset?._embedded?.['http://ns.adobe.com/adobecloud/rel/metadata/asset']?.['dc:description'];

const imgObj = { src: `https://${pubRepoId}${path}`, style: 'width: 180px' };
if (alt) imgObj.alt = alt;

const fpo = state.schema.nodes.image.create(imgObj);
view.dispatch(state.tr.insert(state.selection.head, fpo).scrollIntoView());
},
Expand Down

0 comments on commit 9450f85

Please sign in to comment.