Skip to content

Announce the plone.plate document model in @blocks-schema - #367

Draft
sneridagh wants to merge 1 commit into
mainfrom
claude/blocks-schema-document-model-a50da7
Draft

sneridagh wants to merge 1 commit into
mainfrom
claude/blocks-schema-document-model-a50da7

Conversation

@sneridagh

Copy link
Copy Markdown
Member

Aligns the @blocks-schema endpoint (#299) with the document model changes in Volto, plone/volto#8503.

Aurora stores a page as one Plate document in blocks.__somersault__, which is the plone.plate document model.

Changes

  • @plone/plate docs: every element docs file has document_model: plone.plate. document.block.md has only document_model: plone.plate, no block: __somersault__. Block docs are unchanged: a block's data is the same in every model.
  • @plone/registry loader (ported from Announce the document model in the @blocks-schema endpoint volto#8503):
    • Element sources carry document_model, keyed element:${document_model}:${name}, so two models can each have an element with the same name.
    • A file with only document_model is the docs of that model: { document_model, path }.
    • The warning names block, element and document_model.
    • virtual/blocks-docs.d.ts lists document_model.
  • @plone/cmsui endpoint:
    • The list returns document_model: { id: 'plone.plate', version: 1 } before document.
    • document comes from the plone.plate model docs, not from the __somersault__ block lookup.
    • Only elements of plone.plate are listed. The plateBlocksConfig filter is unchanged.
    • The Markdown list has _Document model \plone.plate`, version 1._under## Document format`, as in Volto.
    • ?type=<type>: with a content path, it replaces the contentType that restricted receives. The list @id and the item links keep ?type=. Aurora has one model, so type doesn't change it, and document_models is never returned.
  • Docs: the endpoint reference and the "Document your blocks" guide cover document_model, the frontmatter, and ?type=.

Announcing the model from the backend, through an FTI setting in @content-types (plone/plone.restapi#2070), is a later step tracked in plone/volto#8502. This PR makes no backend calls.

Testing

  • pnpm --filter @plone/registry test, pnpm --filter @plone/plate test, pnpm --filter @plone/cmsui test: all pass.
  • check:ts passes for registry, plate and cmsui. ESLint passes on the changed files.
  • packages/cmsui/acceptance/tests/blocks-schema.test.ts is updated, with a new test for ?type=. I didn't run it locally; CI runs it.

Align the endpoint with plone/volto#8503: element docs name their
document_model, the page document docs are the docs of plone.plate,
the list returns document_model, and a type query parameter sets the
content type that restricted receives.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant