Repository navigation
Visual editing for pages built with blocks: nested fields in place, one publish per page, block actions #3800
DiogoDuart3
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
In 1.1.0 the edit-mode toolbar only edits top-level fields:
getFieldKind(manifest, collection, field)looks the field up by name, andsaveFieldsends{ data: { [field]: value } }. On a page built with ablocksfield (or with repeaters), every click opens the admin, so a page builder can't be used on the page. We run a ~250-line patch ofpackages/core/src/visual-editing/toolbar.tsin production and would like to upstream it. Proposal in steps:layout.<_key>.<field>addresses a block field by the block's stable key, and<field>.<index>.<sub>a repeater item, nested in any order (layout.<_key>.items.0.title). The kind is resolved through the manifest: the stored block's_type/_versiongives the block type version, a repeater gives its sub-fields. The stored value is read through the path, for the "shown as stored" check and the image popover. A save reads the latest data (draft included) and PUTs the whole top-level field with the one value replaced, keys kept. Templates need a way to emit these, e.g.entry.edit.at("layout", block._key, "heading")orentry.edit["layout.<key>.heading"].ToolbarLabelswith catalog messages, likepublish/editMode.textfields. An element whose only extra children are<br>still shows the stored text; compare througheditableTextinstead of opening the admin.data-emdash-block='{"field":"layout","key":"…"}') on which the toolbar draws a small bar: move up/down, duplicate, hide, delete, and "insert block here" with the admin's picker, saved through the same content PUT with_versionfrom the block type and keys preserved.Questions: should nested paths become part of
entry.edit's public API? Should publish-all be the default when several entries are annotated? Should block actions live in the core toolbar or be opt-in per field?If parts 1 to 4 are agreed, we can open them as separate PRs.
Drafted with AI assistance (Claude Code), from a patch we run in production on 1.1.0.
All reactions