-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Extensibility: Make Block Bindings work with editor.BlockEdit hook (2nd try) #67519
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
gziolo
added
[Feature] Block bindings
[Feature] Extensibility
The ability to extend blocks or the editing experience
[Type] Bug
An existing feature does not function as intended
labels
Dec 3, 2024
gziolo
force-pushed
the
fix/hooks-order-block-bindings
branch
from
December 3, 2024 10:33
5c4ff54
to
5365702
Compare
Size Change: -698 B (-0.04%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
Closing in favor of #67523. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Feature] Block bindings
[Feature] Extensibility
The ability to extend blocks or the editing experience
[Type] Bug
An existing feature does not function as intended
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.
What?
It wasn't possible to use
editor.BlockEdit
filter to extend the block with additional controls and successfully usesetAttributes
orattributes
for connected attribute using Block Bindings.Why?
The way all the logic for enhancing
attributes
andsetAttributes
was connected too deep in the React components chain. It was below the point whereeditor.BlockEdit
allows overriding the Edit component. In effect the defaultattributes
andsetAttributes
were passed to the component as if it wasn't connected with Block Bindings mechanism.How?
Refactored the code to move the logic higher in the hierarchy so all required child blocks receive access to enhanced
attributes
andsetAttributes
props.Testing Instructions
I included a new e2e test that covers the extensibility point for
editor.BlockEdit
hooks that uses the enhanced props correctly by consuming them through input field injected into inspector controls:The simplest way to test it is using the Gutenberg Test Block Bindings plugin included with e2e tests:
text_field_value
.Content
.