feat(pages): upload an image from a Custom HTML block and copy its link #74

Merged
ngqile merged 1 commits from add-html-image-upload into main 2026-12-04 02:10:26 +00:00
Owner

This PR implements the OpenSpec change add-html-image-upload.

A Custom HTML block's panel now has an Upload image picker. The image uploads straight away for the page's company, through the existing POST /api/pages/images and with the same type and size checks as other page images. The panel then shows each upload with:

  • a preview;
  • its link /api/public/page-images/<id>;
  • a copy button.

What it does not do

  • It never changes the block's HTML.
  • It needs no change on the server.

Errors

  • A refused file shows the reason under the picker.
  • On a new page where a super admin has not chosen a company yet, it asks them to choose one first.

Checks

  • The new editor tests failed first and pass now.
  • vitest: 1997 passed, exit code 0.
  • tsc is clean, and lint has 0 errors.
  • openspec validate --strict passes.
  • I checked it live on port 3001:
    • uploaded an image on Hotel technology and saw its link and preview;
    • a text file named .png was refused;
    • the page was not saved.

Labels: the English and Chinese labels are added, plus a SQL file for them in the change folder.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs

This PR implements the OpenSpec change `add-html-image-upload`. A Custom HTML block's panel now has an **Upload image** picker. The image uploads straight away for the page's company, through the existing `POST /api/pages/images` and with the same type and size checks as other page images. The panel then shows each upload with: - a preview; - its link `/api/public/page-images/<id>`; - a copy button. **What it does not do** - It never changes the block's HTML. - It needs no change on the server. **Errors** - A refused file shows the reason under the picker. - On a new page where a super admin has not chosen a company yet, it asks them to choose one first. **Checks** - The new editor tests failed first and pass now. - vitest: 1997 passed, exit code 0. - tsc is clean, and lint has 0 errors. - `openspec validate --strict` passes. - I checked it live on port 3001: - uploaded an image on Hotel technology and saw its link and preview; - a text file named `.png` was refused; - the page was not saved. Labels: the English and Chinese labels are added, plus a SQL file for them in the change folder. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
ngqile added 1 commit 2026-12-04 02:10:23 +00:00
ngqile merged commit bba99993cb into main 2026-12-04 02:10:26 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ngqile/co-lite#74