Content blocks: Shown in the page, the card only, or both (migration 071)
A card block also showed on the record's page (the pages printed the card's paragraphs above the body), which the editor didn't say. Shown in now offers The page, The card only, and The card and the page. Every existing card block becomes both, so nothing on the site moves; the pages no longer print card paragraphs, and a both block comes with the page's blocks, in its place in the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b55b088e16
commit
8d6bb8c2b8
10 changed files with 103 additions and 32 deletions
|
|
@ -53,7 +53,8 @@ export function loadLinks(db, ownerKind, ids) {
|
|||
}
|
||||
|
||||
/* ── Blocks ────────────────────────────────────────────────────
|
||||
Map of owner_id → blocks for one slot, items attached.
|
||||
Map of owner_id → blocks for one slot, items attached. A
|
||||
"both" block (071) is in the card's and the body's.
|
||||
|
||||
Two queries: the blocks, then every item belonging to them.
|
||||
Blocks with no children come back with an empty items array
|
||||
|
|
@ -68,7 +69,7 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
|||
.prepare(
|
||||
`SELECT id, owner_id, type, text, media, href, alt, cite, captions, team_id
|
||||
FROM content_blocks
|
||||
WHERE owner_kind = ? AND slot = ? AND owner_id IN (${placeholders(ids.length)})
|
||||
WHERE owner_kind = ? AND slot IN (?, 'both') AND owner_id IN (${placeholders(ids.length)})
|
||||
ORDER BY owner_id, sort_order`,
|
||||
)
|
||||
.all(ownerKind, slot, ...ids);
|
||||
|
|
@ -145,7 +146,8 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
|||
The card slot is paragraphs by convention, so it collapses to
|
||||
an array of strings, desc_a and desc_b become description[0]
|
||||
and description[1]. A non-paragraph block in the card slot is
|
||||
ignored here; put it in the body slot instead.
|
||||
ignored here. Only cards show it: a record's page draws its
|
||||
body blocks, "both" ones among them.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
|
||||
export function paragraphs(blocks = []) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue