Add link card blocks to post bodies
A "cards" content block: each item is a card with a picture, title and description that links somewhere, like a link shared in a chat. Fetch preview fills the card from the link. Migration 044 (not deployed yet) now allows both table and cards. Also fixes hidden-field clearing when two fields share a path, and adds table and card blocks to the showcase post. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5dceeb5860
commit
4e9b4e3329
8 changed files with 123 additions and 18 deletions
|
|
@ -160,9 +160,13 @@ export function fieldShown(field, row, parent?) {
|
|||
the engine's deliberate clear, so it saves as NULL. */
|
||||
function withHiddenCleared(spec, row, parent?) {
|
||||
let next = row;
|
||||
// Two fields can share a path, each shown for a different kind of
|
||||
// row (a card's Description and a list item's Detail are both
|
||||
// `detail`); a value is only hidden when none of them is showing.
|
||||
const shownPaths = new Set(spec.fields.filter((f) => fieldShown(f, row, parent)).map((f) => f.path));
|
||||
for (const field of spec.fields) {
|
||||
const value = next[field.path];
|
||||
if (!fieldShown(field, next, parent) && value != null && value !== "") {
|
||||
if (!shownPaths.has(field.path) && value != null && value !== "") {
|
||||
next = { ...next, [field.path]: "" };
|
||||
}
|
||||
}
|
||||
|
|
@ -303,6 +307,7 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
locked={locked}
|
||||
className={locked ? inputLocked : common.className}
|
||||
showButton={!field.previewWhen || fieldShown({ when: field.previewWhen }, row)}
|
||||
fills={field.previewFills}
|
||||
onChange={onChange}
|
||||
onPatch={onPatch}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue