Visual text editor; Cards, FAQ and HTML blocks instead of HTML in text #10

Merged
reudy merged 2 commits from visual-editor-blocks into main 2026-10-26 14:19:13 +01:00
Member

Text blocks no longer carry hand-written HTML. Text is edited visually, and the layouts the evashafik site needed are now blocks of their own.

What changes

  • Visual text editor (Tiptap). It replaces the old execCommand editor and offers paragraph, H2, H3, bold, italic, strikethrough, link, bulleted and numbered lists, pull quote, divider line, clear formatting, undo and redo.
    • It can only produce simple HTML: no inline styles and no layout markup. The allowed tags are listed once, in packages/shared/src/richText.ts.
    • Card text and FAQ answers use a compact toolbar without headings, quotes or lines. Emails keep the full toolbar.
  • Text block options: Alignment (left or centre) and Text size (normal, or small for footnotes). Small text sits directly under the block above it.
  • New blocks:
    • Cards: a heading, an optional intro, and cards with a picture or a step number. Each card has a title, an optional subtitle, short text, and an optional link that makes the whole card clickable, with optional link text.
    • FAQ: questions that open to show their answers.
    • HTML: raw HTML for embeds and one-offs. The editor's hint covers that it needs inline styles, that scripts don't run, and that anything loaded from another site shares visitors' IP addresses.
  • Anchor on every block (next to Background), so links like #prices jump to that block.
  • Pull quote styling in .prose-wellness: serif italic with a bar in the primary colour.

Existing content

  • Old text blocks the editor can't represent would be mangled on the first edit. Migration 1793300000_text_blocks_visual_editor.js turns them into HTML blocks that render exactly as before.
  • Text that was only centred becomes clean text with Alignment: centre.
  • Backup import applies the same rule, so older export files still load.

Backup

backups/evashafik-enhanced.json (your latest export) is rebuilt with the new blocks:

  • The cards, steps, Read next and programme price cards are Cards blocks, and the FAQs are FAQ blocks.
  • The pull quotes are quotes, and the article references are footnote text.
  • #prices, #buy and #book are block anchors. The sessions hero's #book link had lost its target when the price table was removed, so it now goes to the Shop block.
  • A script checked that every page keeps the same words. The only differences are the step numbers, which are now generated, and "Book this programme", which is now the cards' link text.

Tested (local test stack)

  • Before and after screenshots of 7 pages at 1280 px and 390 px:
    • Old content after the migration and the old-format import has exactly the same page heights as before.
    • The new blocks match the old layouts. The visible differences are listed under "Not the same".
  • Editor: writing with the toolbar gives <h2>…</h2><p>…<strong>…</strong>…</p><blockquote>…</blockquote>.
    • Selecting every block on home, about, myprograms and privacy doesn't mark the page unsaved, with no console errors.
    • This found and fixed an effect loop, plus the empty paragraph Tiptap appended after a closing heading.
  • Saving: adding Text, Cards, FAQ and HTML blocks and saving works, and they render on the public site, including the anchor, the HTML's inline style and opening an FAQ.
  • Type checks: svelte-check shows 0 errors in both apps.

Not the same

  • On the programme cards, the discounted price is bold but no longer large and red, because the editor has no colour or size.
  • FAQ questions show + / × instead of the browser's triangle.

svelte-tiptap, @tiptap/extension-link and @tiptap/extension-placeholder are still in app-admin/package.json but unused (StarterKit includes links). They can be removed separately.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW

Text blocks no longer carry hand-written HTML. Text is edited visually, and the layouts the evashafik site needed are now blocks of their own. ## What changes - **Visual text editor (Tiptap).** It replaces the old `execCommand` editor and offers paragraph, H2, H3, bold, italic, strikethrough, link, bulleted and numbered lists, pull quote, divider line, clear formatting, undo and redo. - It can only produce simple HTML: no inline styles and no layout markup. The allowed tags are listed once, in `packages/shared/src/richText.ts`. - Card text and FAQ answers use a compact toolbar without headings, quotes or lines. Emails keep the full toolbar. - **Text block options:** *Alignment* (left or centre) and *Text size* (normal, or small for footnotes). Small text sits directly under the block above it. - **New blocks:** - **Cards:** a heading, an optional intro, and cards with a picture or a step number. Each card has a title, an optional subtitle, short text, and an optional link that makes the whole card clickable, with optional link text. - **FAQ:** questions that open to show their answers. - **HTML:** raw HTML for embeds and one-offs. The editor's hint covers that it needs inline styles, that scripts don't run, and that anything loaded from another site shares visitors' IP addresses. - **Anchor on every block** (next to Background), so links like `#prices` jump to that block. - **Pull quote styling** in `.prose-wellness`: serif italic with a bar in the primary colour. ## Existing content - Old text blocks the editor can't represent would be mangled on the first edit. Migration `1793300000_text_blocks_visual_editor.js` turns them into HTML blocks that render exactly as before. - Text that was only centred becomes clean text with *Alignment: centre*. - Backup import applies the same rule, so older export files still load. ## Backup `backups/evashafik-enhanced.json` (your latest export) is rebuilt with the new blocks: - The cards, steps, *Read next* and programme price cards are Cards blocks, and the FAQs are FAQ blocks. - The pull quotes are quotes, and the article references are footnote text. - `#prices`, `#buy` and `#book` are block anchors. The sessions hero's `#book` link had lost its target when the price table was removed, so it now goes to the Shop block. - A script checked that every page keeps the same words. The only differences are the step numbers, which are now generated, and "Book this programme", which is now the cards' link text. ## Tested (local test stack) - **Before and after screenshots** of 7 pages at 1280 px and 390 px: - Old content after the migration and the old-format import has exactly the same page heights as before. - The new blocks match the old layouts. The visible differences are listed under "Not the same". - **Editor:** writing with the toolbar gives `<h2>…</h2><p>…<strong>…</strong>…</p><blockquote>…</blockquote>`. - Selecting every block on home, about, myprograms and privacy doesn't mark the page unsaved, with no console errors. - This found and fixed an effect loop, plus the empty paragraph Tiptap appended after a closing heading. - **Saving:** adding Text, Cards, FAQ and HTML blocks and saving works, and they render on the public site, including the anchor, the HTML's inline style and opening an FAQ. - **Type checks:** `svelte-check` shows 0 errors in both apps. ## Not the same - On the programme cards, the discounted price is bold but no longer large and red, because the editor has no colour or size. - FAQ questions show + / × instead of the browser's triangle. `svelte-tiptap`, `@tiptap/extension-link` and `@tiptap/extension-placeholder` are still in `app-admin/package.json` but unused (StarterKit includes links). They can be removed separately. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
agent added 2 commits 2026-10-26 13:58:35 +01:00
The text editor (Tiptap) only produces simple HTML: headings, bold,
italic, strikethrough, links, lists, pull quotes, lines. Layouts that
were hand-written HTML in text blocks get their own blocks (Cards with
pictures or numbered steps, FAQ), one-offs and embeds go in an HTML
block, and every block can have an anchor for #links. Text blocks get
alignment and a small (footnote) size.

Existing text blocks the editor can't represent become HTML blocks that
render exactly as before (migration, and backup import for old files);
text that is only centred becomes centred text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
Same text: cards, steps, Read next and programme prices are Cards
blocks, the FAQs FAQ blocks, pull quotes quotes, references small text.
#prices, #buy and #book are block anchors (#book on /sessions had lost
its target with the price table).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
reudy merged commit d29f101b29 into main 2026-10-26 14:19:13 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: reudy-net/domaino#10
No description provided.