// add-custom-html-block: a Custom HTML block runs sealed. It is served as its own document whose // Content-Security-Policy `sandbox` gives it an opaque origin, even when its address is opened directly, and it is // shown in an with the same grants. No same-origin, forms, top navigation or modals. export const FRAME_SANDBOX = "allow-scripts allow-popups allow-popups-to-escape-sandbox"; /** The frame document's own policy. next.config sends it too: config headers replace a route's header of the same name. */ export const FRAME_CSP = `sandbox ${FRAME_SANDBOX}; frame-ancestors 'self'`; export const FRAME_MESSAGE = "colite-frame-height"; /** The page asks a frame to report its height again: its first report can come before the page listens (add-hero-full-width). */ export const FRAME_ASK_MESSAGE = "colite-frame-ask"; export const START_HEIGHT = 600; const MIN_HEIGHT = 20; const MAX_HEIGHT = 20000; export const FRAME_ANCHOR_MESSAGE = "colite-frame-anchor"; /** A block link name, as in cmsPages (kept here as a string for the frame script). */ const ANCHOR_SOURCE = "^(?!reg-)[a-z0-9][a-z0-9-]{0,39}$"; const ANCHOR = new RegExp(ANCHOR_SOURCE); // Posts the content height (not scrollHeight, which never drops below the frame itself) to the parent page on load, whenever it changes, and when the page asks. A click on a #name link // (add-page-anchor-links) asks the page to scroll instead: the frame is as tall as its content and never scrolls. const FRAME_SCRIPT = ``; /** The pasted HTML with the frame script before its last