Editor: Edit synced patterns, template parts, and patterns inline#77921
Draft
richtabor wants to merge 10 commits into
Draft
Editor: Edit synced patterns, template parts, and patterns inline#77921richtabor wants to merge 10 commits into
richtabor wants to merge 10 commits into
Conversation
Replace "Edit original" navigation-to-isolated-view with an inline
Edit/Done toolbar toggle for synced patterns and template parts. Their
inner blocks now write back to the entity directly when in edit mode,
so changes propagate without leaving the canvas. "Edit original"
remains in the block settings menu (alongside Detach) for users who
still want the isolated editor.
Three concepts:
1. Inline editing for entity-referenced blocks
- Synced patterns (`core/block`) and template parts swap the
toolbar "Edit original" button for an Edit/Done toggle.
- Children become editable when `editedContentOnlySection ===
clientId`. The reducer flips them from `disabled` to `default`
editing mode for the duration of the edit.
- "Edit original" stays available as a block-settings menu item.
- Inspector card uses the actual block's icon, title, and
description (was forced "Pattern" / `symbol` icon /
"A block pattern."). Same for the List View row icon.
2. Content-only editing foundation
- Sections are now opt-in via explicit `templateLock: 'contentOnly'`
or entity type (template part / synced pattern), not position-
in-tree inference.
- New `editContentOnlySection` / `stopEditingContentOnlySection`
private actions and `getEditedContentOnlySection` /
`isWithinEditedContentOnlySection` private selectors.
- New `EditSectionButton` toolbar (Edit/Done) for any block with
`templateLock: 'contentOnly'`.
- New `useListViewEditedSectionSync` hook auto-expands the edited
section's subtree in List View while editing.
3. Pattern auto-locking on insert
- `parsePattern` stamps `templateLock: 'contentOnly'` on the
wrapping block of single-block patterns (preserves explicit
author-set values, including \`false\`).
- The block lock modal gains a "Lock layout" checkbox so users
can lift this auto-lock — and Detach also clears the lock,
so either action returns the wrapper to a regular editable
block. The two affordances are symmetric: removing layout
lock from a pattern also detaches its identity, and detaching
also clears its layout lock.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Size Change: -208 B (0%) Total Size: 8.04 MB 📦 View Changed
ℹ️ View Unchanged
|
Contributor
|
@richtabor It did already work like this at one point, it was the one of the first things tried as part of the Pattern Editing work. It was changed back to using the isolated editor in this PR - ContentOnly: For template parts and synced patterns, ensure 'Edit section' button goes to the isolated editor. The reasoning behind it was the isolated editing apparently makes it clearer that the user is editing a global/synced entity. I'm personally not against changing it back. It might need some broader discussion though. |
# Conflicts: # packages/block-editor/src/components/block-inspector/edit-contents.js # packages/block-editor/src/components/block-toolbar/edit-section-button.js # packages/block-editor/src/components/block-toolbar/switch-section-style.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an inline Edit / Done flow for editing content-only sections directly in the canvas, with the current scope limited to:
For template parts and synced patterns, the toolbar now shows Edit instead of using Edit original as the primary action. Clicking Edit temporarily unlocks the entity contents in place; clicking Done restores the locked/content-only presentation. Edit original remains available from the block settings menu for cases where the isolated editor is still needed.
For inserted patterns/content-only sections, the existing toolbar affordance is aligned with the same Edit / Done wording and placement. Pattern identity passed through insertion metadata is preserved on single inserted/replaced wrapper blocks so inserted patterns can be recognized by the section editing selectors.
Before
editing-2.mp4
After
edit-done.mp4
What changed
default,Why
Editing a synced pattern or template part currently pushes the user toward a separate editing context. This keeps the user in the canvas while making the edit boundary explicit: Edit means changes are applied to the source entity, and Done returns the canvas to its protected/content-only state.
Test plan
Automated checks
These focused checks were run locally: