Explore block bindings UI from PR #655
Open
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.
This PR explores the proposed block bindings UI from this Gutenberg PR:
WordPress/gutenberg#71542
The videos below show a "Shopify Mock Store Block" (one of the examples included in our GitHub repo).
Dropdown UI
The dropdown UI is flexible enough to work for simple workflows, with two main current limitations:
button_url,image_url,image_alt, etc. In our current custom UI, we filter the available bindings to ones that make contextual sense. For example, for the Image blockurlattribute, we only show bindings that map to animage_urltype.data) in theeditorUIfunction, we don't have access to the attribute name. In the video, you can see that we are forced to supply all the available options, even when it's clear to the user that they won't work.editorUIfunction. This would also allow us to make an informed decision about whether to use the dropdown or modal UI inside the editorUI function.image_urltype.dropdown.mov
Modal UI
The modal UI gives us total flexibility, and we are able to inspect the block and attribute names and filter out bindings that don't make contextual sense. We can also render custom controls. (This was hacked together quickly, so excuse the rough UI edges.)
modal.mov