Conversation
Documents store image src as a path relative to the published page (./media_...), which only resolves once served from the site's preview/live origin. The prose editor UI runs on a different origin, so those images 404 while editing. Rewrite the rendered <img> src to the doc's preview origin for display only, leaving the saved (relative) src untouched. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
Commits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
srcas a path relative to the published page (./media_...), which only resolves once the page is served from its preview/live origin.mediaBusImage.jsnow rewrites the rendered<img>src to the doc'shttps://main--{site}--{org}.preview.da.live/media_...origin for display only, via aview()/update()DOM patch — the underlying document node attrs (and thus the saved source) keep the relative path unchanged.index.jsbeyond the plugin wiring that was already in place, nor toimageFocalPoint.js(avoided a competingnodeViews.imageregistration, which would have silently broken focal-point editing).Test plan
test/unit/blocks/edit/prose/plugins/mediaBusImage.test.jscovering the src-rewrite helper and end-to-end rendering (asserts the rendered<img>src is rewritten while the doc'sattrs.srcstays relative; non-media srcs are left untouched).npm test): 1799 passed, 0 failed, 4 skipped../media_...image in the prose editor and confirm it renders in both an editable and a read-only (nowritepermission) session, and that the saved document source still contains the relative path.🤖 Generated with Claude Code