Block Bindings: Refactor block bindings editor implementation#58059
Closed
SantosGuillamot wants to merge 12 commits into
Closed
Block Bindings: Refactor block bindings editor implementation#58059SantosGuillamot wants to merge 12 commits into
SantosGuillamot wants to merge 12 commits into
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
|
This was referenced Jan 22, 2024
Contributor
Author
|
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. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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-editorhook to insert the block bindings UI in the allowed blocks: link.addFilterto 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.