Conversation
…experimental phase
|
Size Change: +89 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 613f31d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7721117227
|
talldan
left a comment
There was a problem hiding this comment.
Works well, thanks for fixing this quickly!
I left one minor comment.
| if ( | ||
| name === 'core/paragraph' || | ||
| name === 'core/heading' || | ||
| name === 'core/image' || | ||
| name === 'core/button' | ||
| ) { |
There was a problem hiding this comment.
I'm not sure this if statement is needed as the one on the line after this already checks for the existence of the bindings attribute, which indicates the block has bindings.
Alternatively the two if statements can be combined to if we want to prevent the logic running on more block types that might be supported in the future:
if (
newAttributes.metadata?.bindings && (
name === 'core/paragraph' ||
name === 'core/heading' ||
name === 'core/image' ||
name === 'core/button'
)
) {The code will be a hot path for loading the editor, so making sure the cheapest statement is first seems like a good idea.
| newAttributes.legacy = true; | ||
| } | ||
|
|
||
| // Convert pattern overrides added during experimental phase. |
There was a problem hiding this comment.
This logic is only necessary in the Gutenberg plugin so it can be put behind the check:
gutenberg/tools/webpack/shared.js
Line 67 in 82e22bf
This way it won't get included in WordPress core.
…ntal phase (#58483) * Update the bindings attribs of blocks added during pattern overrides experimental phase * Update all the binding attributes * Minor optimization / code quality change --------- Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
|
I just cherry-picked this PR to the release/17.6 branch to get it included in the next release: 63c3c4e |
What?
Maps the old source attribute name of
name: 'pattern_attributes'tocore/pattern-overridesWhy?
In #58434 the binding attribute was updated which means that any pattern overrides add before this change no longer work, and it isn't possible to manually update them as the
Allow pattern overridestoggle does not appear.How?
Uses the
convertLegacyBlockNameAndAttributesmethod to map to the new naming.Testing Instructions
Screenshots or screencast
Before:
attribs-before.mp4
After:
attribs-after.mp4