-
Notifications
You must be signed in to change notification settings - Fork 4.6k
[PoC] Patterns: try partial syncing of inner blocks #56348
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
Closed
glendaviesnz
wants to merge
11
commits into
trunk
from
try/partial-sync-no-monkey-patching-inner-blocks
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
caf5085
Try using the block connections api
aaronrobertshaw febe7e1
Remove support for heading block
kevin940726 a6c5e62
Try using cloned blocks and syncDerivedBlockAttributes
kevin940726 a324d55
Make sure to put behind the experiment
kevin940726 a50746e
Fix php lint errors
kevin940726 fb43ec2
Add comment
kevin940726 6befb37
Fix focus loss
kevin940726 73cce16
Try adding partial syncing of list block inner blocks
glendaviesnz f332e5c
Only serialize the innerBlocks
glendaviesnz 12ed8b5
Process innerBlocks on frontend
glendaviesnz e445e5f
Remove unused imports
glendaviesnz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?php | ||
| /** | ||
| * Pattern block support flag. | ||
| * | ||
| * @package gutenberg | ||
| */ | ||
|
|
||
| $gutenberg_experiments = get_option( 'gutenberg-experiments' ); | ||
| if ( $gutenberg_experiments && array_key_exists( 'gutenberg-connections', $gutenberg_experiments ) ) { | ||
| /** | ||
| * Registers the dynamicContent context for block types that support it. | ||
| * | ||
| * @param WP_Block_Type $block_type Block Type. | ||
| */ | ||
| function gutenberg_register_pattern_support( $block_type ) { | ||
| $pattern_support = property_exists( $block_type, 'supports' ) ? _wp_array_get( $block_type->supports, array( '__experimentalConnections' ), false ) : false; | ||
|
|
||
| if ( $pattern_support ) { | ||
| if ( ! $block_type->uses_context ) { | ||
| $block_type->uses_context = array(); | ||
| } | ||
|
|
||
| if ( ! in_array( 'dynamicContent', $block_type->uses_context, true ) ) { | ||
| $block_type->uses_context[] = 'dynamicContent'; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Register the block support. | ||
| WP_Block_Supports::get_instance()->register( | ||
| 'pattern', | ||
| array( | ||
| 'register_attribute' => 'gutenberg_register_pattern_support', | ||
| ) | ||
| ); | ||
| } |
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following will need some work. Currently, there is no common attribute that identifies what the outer wrapper tag is across blocks using innerBlocks. This currently just gets the first tag in the content, which works for lists, but may not for other blocks, so we may need to add an additional attribute to the blocks to clearly identify the innerBlocks wrapper.