Skip to content

feat(da-parser): add link-img asset delivery type for image nodes - #27

Draft
shsteimer wants to merge 2 commits into
mainfrom
linkimg
Draft

shsteimer wants to merge 2 commits into
mainfrom
linkimg

Conversation

@shsteimer

@shsteimer shsteimer commented Sep 15, 2026

Copy link
Copy Markdown

Summary

  • Adds image node attr editAs='image': edited as a real <img>, serialized by doc2aem as a plain <a href title data-edit-as="image"> link (alt → title, no <picture>).
  • Presence-only marker on the persisted <a>: it's purely an authoring signal telling aem2doc "load this link back as an image node" — the published page/decoration code never needs to look at it.
  • New higher-priority parseDOM rule (a[data-edit-as]) round-trips that shape back to an image node.
  • matches() in html-parser.js (Node-side selector matcher used by aem2doc) only needed a small fix: hyphenated attribute names in the existing single-bracket presence check (toHastPropName), not a rewrite to support compound/value-equality selectors — the marker is presence-only, so the actual value is read in getAttrs, not compared in the selector.
  • Fully backwards compatible: existing images/links unaffected (regression-tested).
  • No manual version bump — semantic-release handles that on merge.

Part of the link-img feature spanning da-parser → da-live → da-collab. da-live/da-collab PRs depend on this one publishing first.

Test plan

  • npm run test:node — 132 passing
  • npm run test:browser — 146 passing
  • npm run lint — clean
  • New tests: toDOM/parseDOM for editAs, doc2aem link-img serialization (no <picture>), full aem2docdoc2aem round-trip, regression test for normal images

🤖 Generated with Claude Code

Adds assetDeliveryType='link-img' image attr: edited/rendered as a real
<img> but serialized by doc2aem as a plain <a href title
data-asset-delivery-type="link-img"> link (alt carried in title, no
<picture>). Round-trips back to an image node on load via a new
higher-priority parseDOM rule. Fixes the Node-side selector matcher
(matches()) to support compound/value attribute selectors, needed for
the new rule to match under aem2doc's Node DOMParser path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…dit-as

Replace the value-matching data-asset-delivery-type="link-img" selector
with a presence-only marker: a[data-edit-as], read/written as a plain
attribute value rather than baked into the parseDOM selector. Avoids
extending matches() to support compound/value-equality selectors --
it only needs single-attribute presence checks, matching the existing
img[src]/a[href] pattern.

Renames the image node attr assetDeliveryType -> editAs (value
link-img -> image) so the internal attr name and DOM attribute
(data-edit-as="image") read as the same concept.

Also stops manually bumping package.json version -- semantic-release
handles that on merge based on commit type.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
shsteimer added a commit to adobe/da-live that referenced this pull request Sep 15, 2026
…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>
shsteimer added a commit to adobe/da-collab that referenced this pull request Sep 15, 2026
Revert @adobe/da-parser to ^2.1.0 -- no real published version exists
yet for the link-img support (adobe/da-tools#27), and da-parser
doesn't hand-bump its own version (semantic-release does that on
merge). Bumping to ^2.2.0 is a required step before merging this PR,
once that version is published.

Update the round-trip test for da-parser's renamed marker:
data-asset-delivery-type="link-img" -> data-edit-as="image".
Verified passing against the (locally npm-linked) updated parser.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant