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
Fix Blocks list ordering in Global Styles #39093
Fix Blocks list ordering in Global Styles #39093
Conversation
If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
Thanks for the PR @mashikag!
I've left a comment and also it's a good opportunity to use getBlockTypes
selector from blocks store.
packages/edit-site/src/components/global-styles/screen-block-list.js
Outdated
Show resolved
Hide resolved
@ntsekouras Thanks for your review and the suggestion. I will fix this up later this evening. |
5167acb
to
2036446
Compare
BTW @ntsekouras after I run |
packages/edit-site/src/components/global-styles/screen-block-list.js
Outdated
Show resolved
Hide resolved
No you shouldn't. I guess you're talking about the |
Besides the small nit about the declaration of the new hook outside return
, this looks good!
Thanks so much for the PR @mashikag !
packages/edit-site/src/components/global-styles/screen-block-list.js
Outdated
Show resolved
Hide resolved
2036446
to
56a7fd1
Compare
…nent This commit ensures that core blocks are always displayed first, ahead of, non-core blocks in the ScreenBlockList component of GlobalStylesUI.
56a7fd1
to
b3cd261
Compare
@ntsekouras No problem! Thanks for your guidance. :) I updated the PR once again to align with your most recent suggestions. |
Congratulations on your first merged pull request, @mashikag! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
Description
This commit ensures that core blocks are always displayed first, ahead of, non-core blocks in the ScreenBlockList component of GlobalStylesUI.
Currently there is an issue that when non-core blocks are registered they are displayed first, ahead of, non-core blocks. This PR is fixing this issue. See the follow-up, before and after, screenshots for reference.
The issue being fixed was discovered and raised here.
Testing Instructions
Install
Jetpack
plugin on your local gutenberg dev env site. This does not have to be necessarilyJetpack
. Any plugin that registers non-core blocks should do.Activate the
Jetpack
plugin. This can be done fromPlugins
->Installed Plugins
.Open site editor, via
Appearance
->Editor
, or by navigating to http://yoursite.com/wp-admin/themes.php?page=gutenberg-edit-siteIn the top right of the editor, click at
![Screenshot 2022-02-25 at 12 07 35](https://webcf.waybackmachine.org/web/20220322002926im_/https://user-images.githubusercontent.com/2019970/155705957-77c6d93f-d806-41b8-8059-40cb79357b47.png)
Styles
icon. This should open upStyles
sidebar on the right hand side of youreditor's screen.
Expand the
Blocks
section in theStyles
sidebar, by clicking at the section's sub-header.Notice how the
Contact info
andMarkdown
non-core blocks are displayed ahead of the core blocks when there is no fix applied, and vice-versa when the fix is applied.Screenshots
Before
Notice how the
![before-blocks-list-ordering-fix](https://webcf.waybackmachine.org/web/20220322002926im_/https://user-images.githubusercontent.com/2019970/155700698-8255f88e-e8ef-4e9a-aa6c-1b39a3ef7680.gif)
Business hours
toTiled Gallery
blocks, which are non-core, are displayed in front of the core blocks.After
Now notice how the
![after-block-list-ordering-fix](https://webcf.waybackmachine.org/web/20220322002926im_/https://user-images.githubusercontent.com/2019970/155700713-4331495a-70a9-416e-93e8-7cfdf53d9dd9.gif)
Business hours
toTiled Gallery
blocks, which are non-core, are displayed after core blocks.Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.js
files for terms that need renaming or removal).