Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2.3 KiB
2.3 KiB
Tasks
1. Portal
-
1.1 HTML block panel: an "Upload image" file picker (
image/png,image/jpeg,image/webp) uploads at once throughuploadPageImage(companyId, base64).- Each success adds a row: preview, a read-only link
/api/public/page-images/<id>, and a "Copy link" button that uses the clipboard. - A refusal shows the translated server reason under the picker.
- With no company, the panel shows "Choose a company." and does not upload.
- The block's HTML is never changed.
Verify: editor tests (success row and copy, refusal, no company, HTML unchanged) fail first, then pass; vitest exit 0; tsc; lint.
- Each success adds a row: preview, a read-only link
-
1.2 Add the labels (
PagesUploadImage,PagesUploadImageHint; the copy button reuses the page-address copy button) todefaultMessages.ts,zh_CN.seed.jsonandsql/01-html-image-labels.sql, and regeneratelocal/seed/04-zh-cn-messages.sql.
2. Verification
- 2.1 Use Playwright on port 3001, signing in through the form and opening Hotel technology from Pages.
- In a Custom HTML block, upload an image, copy the link, and check that the panel shows the preview and the link.
- Upload a file that is not an image and see the refusal.
- Do not change the published page.
- 2.2 Run the full portal vitest (exit 0), tsc, lint, and
openspec validate add-html-image-upload --strict. Add a release note todocs/deployment.md(label SQL).
Notes (2026-12-04)
- Red first: the success, refusal and no-company editor tests all failed, because there was no "Upload image" picker yet. They pass now.
- Live check (port 3001): signed in through the form, then opened Hotel technology from Pages.
- In block 3 (Custom HTML), uploaded
hero-bg.webp. The panel showed the preview and/api/public/page-images/7with a copy button. - A text file named
.pngwas refused with "Use a PNG, JPEG or WebP image." - The page was not saved or published.
- In block 3 (Custom HTML), uploaded
- Fix from the live check: the link was shown twice (a read-only box and the copy button's text). It now shows once, beside its copy button, which reuses the page-address copy button with a
relativeoption. - Results: vitest 1997 passed (exit 0); tsc clean; lint 0 errors (the 4 warnings were already there).
Workflow follow-up
- Open a PR to
mainand merge it. Archive the change on its own branch, with its own PR.