# Proposal: add-page-visual-editor ## Why INS and CV marketing staff build a page for every event and are not technical. Today they fill in a form of blocks and check a separate preview of the last saved version. The owner asked for a Wix-like editor: staff click the page itself to change it and see the result as they work. This is change 3 of the page builder (`docs/superpowers/specs/2026-12-03-page-builder-design.md`). Changes 1 (sections) and 2 (drafts, templates, Duplicate) are live. ## What Changes - **On-page editor** at 1024 px and wider. The page renders in a canvas inside the editor, at the desktop width scaled to fit, or at phone width (390 px). It uses the same `LandingPage` rendering as visitors see. A side panel shows the selected section's settings, or the page settings when no section is selected. - **Edit in place.** - Headings, short texts, button labels, card titles and texts, and FAQ questions and answers are edited as plain text on the canvas, with the server's length limits. - Rich text (Text, and Image with text) is edited in place with a small toolbar. - Clicking an image spot opens the file picker. - **Section actions.** Select, a toolbar (drag handle, up, down, duplicate, delete), and "+ Add section" between sections and at the end. - **Undo and redo** for the page, up to 50 steps, with Ctrl+Z, Ctrl+Shift+Z and buttons. - **Change 2 carried over.** The editor's top bar keeps Save, Preview, View page, Duplicate, Delete, the unpublished-changes banner with Publish changes and Discard changes, and the status. Templates and Duplicate open in the new editor. - **Refusals on the canvas.** A refused field's section is selected and outlined, and the panel shows the message at the field. - **Unsaved changes.** In-app links now ask before leaving with unsaved changes, in both editors. Today only reload and close ask. - **Below 1024 px** the current form editor stays, with Preview. ### Departures from the approved design doc These are builder calls, recorded in `design.md`: 1. **Canvas wiring.** The editor renders the page into a blank same-origin frame itself, instead of loading a canvas address that exchanges the draft by `postMessage`. There is one copy of the draft and no message protocol. A spike task proves it first, with a canvas route as the named fallback. 2. **Desktop view** renders at 1280 px and is scaled down to fit beside the panel, so the page's own breakpoints match a desktop visitor's. "Full width" would show the tablet layout on a laptop. 3. **Custom HTML** on the canvas shows the last saved version, with a "Save to update" mark once its HTML is edited. It reloads after Save. Unsaved pasted HTML cannot run sealed with today's frame routes and script policy. ## Capabilities ### New Capabilities None. ### Modified Capabilities - `landing-pages`: - The Page Editor, Saving And Deleting In The Editor, The Custom HTML Block In The Editor, and New Sections In The Editor change. - The on-page editor requirements are added: canvas, editing in place, section actions, undo, and refusals on the canvas. ## Impact - **Portal only:** - New: `app/components/pages/visual/*` (canvas, panel, top bar, history). - `PageEditor` state moves into a shared hook used by both editors. - `CmsBlocks` gains edit-mode hooks, which the public page does not use. - `HtmlFrame` listens on the window of the document it is in. - A leave guard for in-app links. - **No server, API, database or SQL changes.** New labels only, with a label SQL file. - **No new dependencies.** Tiptap is already installed; dragging uses native drag-and-drop.