-
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
Block Bindings: Refactor block bindings editor implementation #58059
Block Bindings: Refactor block bindings editor implementation #58059
Conversation
This reverts commit 6a19c42.
Size Change: +1.67 kB (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
Flaky tests detected in ef5c81e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7608244110
|
Closing this pull request in favor of this other one, where I start smaller and with a specific use case, which is just understanding the bindings from the editor and modifying the UI of the existing blocks to reflect that. The rest of the logic included here can be used in the future to create the block bindings UI. |
WIP
This PR is still a draft. I'm opening it to discuss some of its aspects.
What?
After discussing the initial proposal for the block bindings editor implementation (#57258), we decided to try a different approach which seems more reliable. The way I'm handling it in this PR:
block-editor
hook to insert the block bindings UI in the allowed blocks: link.addFilter
to add the needed context to all the allowed blocks: link.<BlockEdit />
attributes and setAttributes to read the bindings: link.Why?
The filters and APIs used seem more suitable for this case.
Testing Instructions
For all the testing we have to go to Gutenberg-Experiments and enable the Test Block Bindings option.
Test that adding the bindings attribute works
Test that multiple attributes values can be connected
Repeat the same process but using a button (or an image) to bind the content and the URL.
Test creating a new source
You can try creating a new source using the post meta as reference and using the APIs created. Once created, it should appear in the block bindings UI, as the post meta does. Bear in mind that the APIs will be private, so sources can only be created inside Gutenberg plugin.