-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patterns: disable editing of synced patterns in post editor unless children have connected content set #56703
Closed
Conversation
This file contains 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
… the pattern block mode
…efault with partial syncing
glendaviesnz
added
[Type] Enhancement
A suggestion for improvement.
[Feature] Patterns
A collection of blocks that can be synced (previously reusable blocks) or unsynced
labels
Dec 1, 2023
Size Change: +446 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
Flaky tests detected in c37ab47. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7054943323
|
Closing in favour of #57036 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Feature] Patterns
A collection of blocks that can be synced (previously reusable blocks) or unsynced
[Type] Enhancement
A suggestion for improvement.
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.
A draft alternative to #56574
What?
This version edits the source pattern in place instead of redirecting to the editor
Locks pattern editing in the post editor to only child blocks that have had content connections set.
N.B. This PR changes the paradigm for editing synced patterns in the editor and moves the editing of a pattern's content that causes global changes to the site editor or the wp-admin pattern editing interfaces (details of why below).
Why?
As part of the work on allowing partial editing of synced patterns we want to disable full editing of the synced pattern entities by default in the post editor.
This will make it easier to indicate to users when they are editing just a section of the pattern for that instance of the pattern only, versus editing the global source pattern instance.
This would also fix #54442 as the edit button only shows if the user has permission to update the pattern. It also fixes #32353
How?
Sets each of the patterns innerBlocks edit mode to
disabled
usingsetBlockEditingMode
unless the block connected attributes are set in which case the block is set tocontentOnly
.Important note - limiting editing to
contentOnly
in the post editor is 🤞 just the starting point. We are keeping it restricted to contentOnly to keep things simple while we set up the initial APIs for implementing partial syncing. The hope is that we can later extend it out to things like innerBlocks, limited block style attributes, etc. when/if the complexities around doing so are resolved.Testing Instructions
Edit parent pattern
button in the block toolbar unlocks the innerBlocks for full editing, andStop editing parent pattern
locks the innerBlocks againEdit parent pattern
button does not display if the user does not have edit permission for the given patterncontentOnly
. Also check that theContent
panel appears in right inspector panel when block or nested content selected.Screenshots or screencast
edit-parent.mp4