Skip to content

feat(da-assets): edit AEM Assets link-img images, persist as <a> links - #1342

Draft
shsteimer wants to merge 16 commits into
mainfrom
linkimg
Draft

shsteimer wants to merge 16 commits into
mainfrom
linkimg

Conversation

@shsteimer

@shsteimer shsteimer commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • New flags sheet flag aem.assets.editableExternalImages = true, which takes effect together with the existing data-sheet aem.assets.image.type = link. With both set, picking an AEM image inserts a real, editable <img> in the doc. Preview and live get a plain <p><a href title data-edit-as="image"> link, the same way a normally authored link is saved. On reload the link comes back as an image. Alt text is carried in the link title.
  • aem.assets.image.type = link without the flag behaves as before (plain link). The flag has no effect unless image.type is link.
  • Wired through both the standard and smart-crop insert paths. The focal-point UI is skipped for these images.
  • Live preview (prose2aem.js) renders the same <p><a> shape that doc2aem saves.
  • Node attr editAs='image' (DOM data-edit-as="image") matches da-parser's presence-only marker (feat(da-parser): add link-img asset delivery type for image nodes da-tools#27).

Depends on adobe/da-tools#27 being merged and published, and on da-collab picking up that parser release.

Demo / testing on the branch

Branch preview, pointed at a locally running da-collab that uses the #27 parser:

https://linkimg--da-live--adobe.aem.live/canvas?da-collab=local#/path

Local setup (temporary, for demos only):

  1. da-tools on linkimg, then npm link in da-parser. da-collab on linkimg uses the linked parser (npm link @adobe/da-parser).
  2. In da-collab, src/shareddoc.js getBackend().fetch is temporarily changed to call admin.da.live over the internet instead of the da-admin-local binding. Uncommitted, local only.
  3. npm run dev in da-collab (serves ws://localhost:4711). Use Chrome; Safari blocks ws://localhost from an https page.
  4. Config: data sheet aem.assets.image.type = link, flags sheet aem.assets.editableExternalImages = true.
  5. ?da-collab=reset switches back to prod collab.

Documents still go through prod da-admin, so use a throwaway page and don't open it in regular da.live at the same time. Prod collab still has the old parser and would remove the marker.

⚠️ Revert before merging

Test plan

  • da-assets unit tests (config flag derivation incl. flags sheet, insert passthrough, standard + smart-crop paths, link/non-image regressions)
  • prose2aem tests (link serialization keeps <p>, other images unaffected)
  • Lint clean
  • Manual end-to-end with published parser, see above

Adds aem.assets.image.type=link-img: pick an AEM asset and it's edited
as a real image, but persists/publishes as a plain <a> link (project
decoration handles it), round-tripping back to an image on reload. Alt
is carried in the link title. Existing aem.assets.image.type=link
(plain-text-link) behavior is unchanged.

- config.js: derive insertAsLinkImg alongside insertAsLink
- insert.js: pass assetDeliveryType through to the image node
- da-assets.js: wire link-img through both the standard and smart-crop
  insertion paths
- imageFocalPoint.js: skip focal-point cropping for link-img images
- prose2aem.js: live preview renders link-img images as the same <a>
  shape doc2aem persists
- bump @adobe/da-parser to 2.2.0 (adobe/da-tools#27) and rebuild
  deps/da-parser/dist/index.js

Depends on adobe/da-tools#27 merging + publishing first (currently
linked locally via npm link for dev).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

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

…r bump

Rename to match da-parser's presence-only data-edit-as marker
(adobe/da-tools#27): assetDeliveryType -> editAs, value
link-img -> image.

Revert the manual @adobe/da-parser version bump and rebuilt
deps/da-parser/dist/index.js -- da-parser doesn't hand-bump its own
version (semantic-release does that on merge), so there's no real
version to point at yet. Required before merging this PR: bump
@adobe/da-parser to the version published from adobe/da-tools#27 and
rerun npm run build:da-parser.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Rename the config value from link-img to editable-link
(insertAsLinkImg -> insertAsEditableLink) for clarity now that the
underlying node/DOM naming is editAs/data-edit-as.

Also collapse the standard-insertion branch to a single else, reusing
the already-computed editAs value instead of re-deriving it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@besimhu

besimhu commented Sep 16, 2026

Copy link
Copy Markdown

For

New aem.assets.image.type = editable-link config value: picking an AEM asset inserts a real editable image, but it persists/publishes as a plain link (so project decoration code can handle it) — round-trips back to an image on reload. Alt is carried in the link title.

Is my understanding that the image will show in the author UI, however for the frontend markdown portion, we are working with the a attribute to format as needed?

@shsteimer

Copy link
Copy Markdown
Contributor Author

@besimhu correct. this only changes the authoring UX. it has no impact on how front end code/developers would handle the images selected from dynamic media.

shsteimer and others added 2 commits September 16, 2026 11:27
…mageType

Single imageType field ('link' | 'editable-link' | null) replaces two
boolean flags; unrecognized aem.assets.image.type values normalize to
null (falls back to normal image insertion).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
shsteimer and others added 3 commits September 22, 2026 08:19
…ExternalImages flag

Keep aem.assets.image.type=link on the data sheet; set
aem.assets.editableExternalImages=true on the flags sheet to insert
images as editable <img> nodes that are still delivered as links.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shsteimer and others added 2 commits September 25, 2026 11:31
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
shsteimer and others added 3 commits September 25, 2026 13:25
Editable link-images persist as <a href=src>, so an image link (href attr) was silently dropped on save and in preview. Hide Create/Edit link in canvas, disable the classic link menu item, and guard Mod-k in both editors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…itAs

A dropped file is uploaded DA media, so the replaced image no longer keeps editAs (which saved it as a text link). Use the iframe's imageIndex, checked against the doc src captured at drop time, to replace only the dropped image; fall back to src matching when absent or drifted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
linkimg — 4d3d8c70 Deployed Oct 1, 2026 by aem-code-sync[bot]
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.

2 participants