-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Style Book: Enable support for showing individual block variations #70448
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
Style Book: Enable support for showing individual block variations #70448
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
da802bd
to
11d49ad
Compare
Hi, @t-hamano. If possible, can you please review this PR? I have a feeling that this could be a nice improvement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Almost everything is working correctly, but I think we need to fix what happens when you click on Preview:
c31f879f381f6af38d3c6f8a1964294d.mp4
When you click on a variation, the URL path changes, and the block that variation is based on is displayed. We may need to disable the click altogether if we don't expect navigation in the first place, but for now, let's keep the current URL path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am temporarily removing my approval as we need to address the issues outlined in this comment.
486a38e
to
7347f6c
Compare
Thanks for the review, @t-hamano! I've implemented the suggested changes. Could you please have another look when you get a moment? pr-demo.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
…ordPress#70448) * feat: show individual variations when selected * doc: clarify intent with a better comment * chore: organize imports * fix: don't return to base when clicked on variation preview Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: tomdevisser <tomdevisser@git.wordpress.org>
What?
Closes #70447
This PR updates the style book to display the selected block variations of individual blocks.
Why?
Previously, the style book preview rendered the default view when a particular block variation was selected instead of rendering the block with the selected variation applied.
How?
The bug mentioned above happened because the block name wasn't properly extracted from the code below, as the presence of variation within the section wasn't considered.
Ref.
gutenberg/packages/edit-site/src/components/style-book/index.js
Line 428 in de11ef9
Testing Instructions
Testing Instructions for Keyboard
Same.
Screencast