Theme switcher, table of contents, missing-page redirect, form placeholders and time field; audit and revalidate fixes
- buildRevalidateHook skips outside Next (no NEXT_RUNTIME) and with context.disableRevalidate - BuilderForm focuses only on a real step change (no scroll to the form on remount) - mediaImageProps: placeholder colour only for JPEG (placeholderColor); hook stores no colour for transparent images - buildLinkField: interface name per shape (CmsLink, CmsLinkPlain, CmsLinkNoLabel) + interfaceName option - Cookie Settings: buttons.save -> buttons.savePreferences (Mongoose reserved name) - ThemeScript, ThemeSwitcher, useTheme; Site Settings defaultTheme 'system' + themeToggleLabel; Turnstile follows page theme - extractHeadings, RenderRichText headingIds, TableOfContents, buildTableOfContentsField - createPageRoute onMissing: 'redirectHome' - Form builder: localized placeholder on text/email/textarea/number, new time field - ipal-audit: no false positive for object keys between JSX elements; /md route not reported as dynamic Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
23e033d7d7
commit
faa4ad679c
@@ -53,6 +53,36 @@ const converters: JSXConvertersFunction = ({ defaultConverters }) => ({
|
||||
Spread `defaultConverters` — nadpisujesz tylko te węzły, które chcesz. Reszta
|
||||
(listy, tabele, obrazy, linki) działa z oficjalnej obsługi Payload.
|
||||
|
||||
## Spis treści i kotwice nagłówków (1.11.1)
|
||||
|
||||
Długie dokumenty (polityka prywatności, regulamin) — spis treści z linkami do sekcji.
|
||||
Id nagłówków w spisie i w treści liczy ta sama funkcja, więc się nie rozjadą.
|
||||
|
||||
```tsx
|
||||
// config bloku
|
||||
import { buildTableOfContentsField } from '@intecion/ipal-kit'
|
||||
fields: [buildTableOfContentsField(), { name: 'content', type: 'richText' }] // grupa tableOfContents: show, label
|
||||
|
||||
// komponent bloku (RSC)
|
||||
import { extractHeadings, RenderRichText } from '@intecion/ipal-kit/rsc'
|
||||
import { TableOfContents } from '@intecion/ipal-kit/client'
|
||||
|
||||
const items = block.tableOfContents?.show ? extractHeadings(block.content) : [] // [{ id, text, level }]
|
||||
{items.length ? <TableOfContents items={items} label={block.tableOfContents?.label} classNames={tocClasses} /> : null}
|
||||
<RenderRichText data={block.content} converters={converters} headingIds={{ className: 'scroll-mt-24' }} />
|
||||
```
|
||||
|
||||
- `extractHeadings(content, { levels: ['h2'] })` — nagłówki w kolejności z tekstu; id = `toSlug(tekst)`,
|
||||
powtórzenia `-2`, `-3`, puste nagłówki pomijane. Także z roota: `import { extractHeadings, headingText } from '@intecion/ipal-kit'`.
|
||||
- `RenderRichText headingIds` — `true` (h2) albo `{ levels, className }`. Twój konwerter `heading` dalej
|
||||
renderuje nagłówek; plugin dokłada `id` (i `className`, np. `scroll-mt-*` pod przyklejonym nagłówkiem).
|
||||
- `<TableOfContents>` — bez stylów: `<nav aria-label={label}>` + `<ol>` linków. Serwer renderuje całą listę
|
||||
(działa bez JS); w przeglądarce link czytanej sekcji dostaje `aria-current="location"` i `classNames.linkActive`.
|
||||
`classNames`: `nav`, `label`, `list`, `item`, `link`, `linkActive`; `offset` (domyślnie 0.3 wysokości ekranu);
|
||||
`data-ipal="toc"`, `data-level` na pozycjach.
|
||||
- `buildTableOfContentsField()` — przełącznik „Show table of contents” + lokalizowana etykieta (typ `TableOfContentsSettings`).
|
||||
Nowe pole w bloku = migracja (`pnpm payload migrate:create`).
|
||||
|
||||
## lexicalToMarkdown — richText → Markdown (dla AI)
|
||||
|
||||
Do czytelności dla agentów AI (Markdown per strona, llms-full) potrzebny jest
|
||||
|
||||
Reference in New Issue
Block a user