Improve content blocks: new types, formatting, and a better editor

Blocks (migration 032): video (click to play, sharing the featured
cards' player), button and callout types; quotes get an attribution
and images alt text separate from the caption. Paragraphs, callouts,
quotes and list items take **bold**, *italic*, [text](url), line
breaks and blank-line paragraphs, parsed into elements (never HTML)
with only safe link schemes. A list item's detail no longer uses an
em-dash.

Editor: each block type shows only its fields, with a named type and
a description, and every open block previews itself with the site's
renderer. Any repeater row can now be duplicated or have a new row
inserted below it; nested collections take `when`, and help text can
depend on the row.

src/seed-showcase.js writes a local test post using every block type
and option. It refuses the production database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 16:50:21 -05:00
parent c62dc84add
commit c5f12c769f
13 changed files with 723 additions and 169 deletions

View file

@ -66,7 +66,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
const blockRows = db
.prepare(
`SELECT id, owner_id, type, text, media, href
`SELECT id, owner_id, type, text, media, href, alt, cite
FROM content_blocks
WHERE owner_kind = ? AND slot = ? AND owner_id IN (${placeholders(ids.length)})
ORDER BY owner_id, sort_order`,
@ -83,6 +83,8 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
text: row.text,
media: row.media,
href: row.href,
alt: row.alt,
cite: row.cite,
items: [],
};
byId.set(row.id, block);