Files

2.8 KiB

Proposal

Why

Marketing staff want to design a landing page with an AI tool and paste the result in, so a page can look like a designed site instead of only the built-in blocks. The INS page is the first case: rebuilt from blocks, it does not match the design of the INS proof of concept (~/Projects/ins-landing-page). On 2026-12-02 the owner chose to show pasted HTML in a sealed frame (option 1). Design approved 2026-12-02: docs/superpowers/specs/2026-12-02-custom-html-block-design.md.

What Changes

  • New block type HTML (Custom HTML).
    • Staff with BO_PAGES paste HTML, at most 200,000 characters per block.
    • Scripts are allowed in this block only. Every other block keeps refusing scripts.
  • Sealed frame.
    • The public page shows each HTML block in an <iframe sandbox> loaded from its own address: /p/<company>/<slug>/frame/<block>.
    • That response carries a sandbox Content-Security-Policy, so the pasted HTML runs with an opaque origin even when the address is opened directly. It cannot reach cookies, Co-Lite APIs, the page around it or top-level navigation, and its forms do not submit.
    • Only Co-Lite pages may frame it (frame-ancestors 'self').
    • Staff preview a draft through a signed-in twin: /pages/<id>/preview/frame/<block>.
  • Frame height: a small script is added to the served HTML. It reports the document height, so the frame grows to fit.
  • Hide page header: a page option that hides the company header and the page title, so a page made of pasted HTML looks exactly as designed.
  • Editor:
    • "Add Custom HTML" with a monospace text box and a character counter;
    • a note that forms in the pasted HTML don't send;
    • the "Hide page header" switch.

Capabilities

New Capabilities

None.

Modified Capabilities

  • landing-pages:
    • the block types gain HTML, with its limit;
    • the scripts rule exempts it;
    • a new requirement covers how it is served sealed and sized;
    • the page gains the "hide header" option;
    • the editor gains the Custom HTML block and the switch.

Impact

  • services-counter:
    • CmsBlockValidator accepts HTML (200,000 characters, no script check);
    • cms_page gets a hide_header column and the page DTO carries it.
  • SQL: sql/01-hide-header.sql (DDL), sql/02-html-block-labels.sql (labels) and sql/99-rollback.sql. Mirror 01 into local/seed/.
  • mobile-api: the admin page request and the public page response carry hideHeader. Blocks already pass through unchanged.
  • Portal:
    • two frame route handlers;
    • middleware.ts leaves the frame routes without the nonce policy;
    • routeGuard admits the public frame path;
    • CmsBlocks renders the frame and honours hideHeader;
    • the editor;
    • labels, with Chinese.
  • Gateway: unchanged.
  • Dependencies: none.