Skip to content

fix: upload dropped images via source.uploadMedia - #1219

Merged
tripodsan merged 1 commit into
mainfrom
imgupld
Aug 7, 2026
Merged

tripodsan merged 1 commit into
mainfrom
imgupld

Conversation

@tripodsan

@tripodsan tripodsan commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Switches image drop uploads (blocks/edit/prose/plugins/imageDrop.js) from source.save to source.uploadMedia.
  • Adds a fast path: when the uploaded image's contentUrl is a relative media reference (starts with ./media_), the FPO placeholder is replaced immediately instead of waiting for the pre-download <img> element's load event.
  • Adds source.uploadMedia to the nx2 api test fixture (test/fixtures/nx2/utils/api.js), which was missing and caused 4 existing tests to fail with source.uploadMedia is not a function.
  • Adds test coverage in test/unit/blocks/edit/prose/plugins/imageDrop.test.js for both behavior changes.

Notes

Test plan

  • npx wtr "./test/unit/blocks/edit/prose/plugins/imageDrop.test.js" --node-resolve --port=2001 — 11/11 tests pass.
  • npm test (full unit suite) — 1781 passed, 0 failed, 4 skipped (unrelated).
  • npx eslint on all changed files — clean.

🤖 Generated with Claude Code

…_ replacement

Switches image drop uploads from source.save to source.uploadMedia, and
replaces the FPO placeholder immediately for relative ./media_ content URLs
instead of waiting on the pre-download <img> load event. Updates the nx2 api
test fixture with the uploadMedia mock and adds coverage for both behaviors.

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

aem-code-sync Bot commented Aug 6, 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

@tripodsan
tripodsan requested a review from kptdobe August 6, 2026 15:47
@tripodsan
tripodsan merged commit dd25d51 into main Aug 7, 2026
5 of 8 checks passed
@tripodsan
tripodsan deleted the imgupld branch August 7, 2026 10:19
tripodsan added a commit that referenced this pull request Aug 10, 2026
Mirrors #1219's switch for dropped images: source.save assumed the
upload path itself was the final addressable URL, but uploadMedia
content-addresses the file, so the real URL (now possibly a relative
./media_... path) is only known from the response. Swap each pasted
image's FPO placeholder for that response URL as soon as its own
upload resolves, instead of waiting for every pasted image to finish.

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.

3 participants