Files
co-lite/openspec/changes/archive/2026-12-04-add-html-image-upload/proposal.md
T

1.9 KiB

Proposal

Why

Custom HTML blocks hold whole designed sections, such as the INS Hotel technology page. Their images must be served from somewhere. Today the only way to get an image link is to upload it as a hero image and read its id back, or to ask a developer. Marketing staff need to upload an image from the Custom HTML block itself and get a link they can paste into their HTML.

What Changes

  • The Custom HTML block's panel gains an Upload image file picker. Choosing a file uploads it at once, for the page's company, with the same checks as every page image:
    • PNG, JPEG or WebP;
    • at most 2 MB;
    • the type is checked by the file's content.
  • Each upload made while the panel is open shows:
    • a small preview;
    • its link (/api/public/page-images/<id>) in a read-only box;
    • a Copy link button.
  • A refused upload shows its reason under the picker.
  • A new page with no company chosen yet asks for one first.
  • The link is relative, so it works on the published page and inside the sealed frame. The INS top bar's logo already loads this way.

Not changing:

  • The server. The existing POST /api/pages/images upload and the public image address are used as they are.
  • Saving. The upload does not touch the page's HTML; staff paste the link where they want it.
  • Unused images. They stay stored, as an unused hero upload would. Clean-up is left for later.
  • The list of uploads, which is not saved. It shows this session's uploads only.

Capabilities

New Capabilities

None.

Modified Capabilities

  • landing-pages: adds "Image Upload For Custom HTML".

Impact

  • Portal:
    • BlockFields.tsx, the HTML block panel;
    • the editor passes the page's company to the panel (or the panel reads it from the draft hook);
    • uploadPageImage already exists.
  • New labels in defaultMessages.ts and zh_CN.seed.json, a regenerated local seed, and a SQL label file in this change folder.
  • No server or schema change.