-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Site Editor: use EditorNotices component for notices #31303
Conversation
Size Change: -43 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
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! ✨
Thanks for the fix, this simplifies things a lot!
Tests performed:
- Trigger snackbar notice by reverting a customized template.
- Trigger success/error/warning/generic notice by dispatching
wp.data.dispatch( 'core/notices' ).createNotice('success', 'Hello World!')
and changing "success" accordingly. - Trigger snackbar notice by dispatching
wp.data.dispatch( 'core/notices' ).createNotice('error', 'Hello World!', { type: 'snackbar' } )
.
Everything works as expected!
There currently is a failing e2e, but I'm fairly sure it's unrelated. I've re-run the jobs, hopefully it will sort itself out. Either way, I don't consider it a blocker for the merge.
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.
Tested and it works well! 🚢
On mobile, the block toolbar is obscuring the notice. This is unrelated to your PR as this happens in the Post Editor as well. I'll check for an open issue and create one if there is none.
Description
Use the
EditorNotices
component from the@wordpress/editor
package for displaying notices in the site editor, rather than a custom component.Allows "default" notices to display at the top of the editor, in addition to the "snackbar" notices that are possible now.
How has this been tested?
Checkout this branch and test both types of notices
default
Run in the JS console of your browser
snackbar
Trigger a snackbar notice, such as by inserting a template part
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist:
*.native.js
files for terms that need renaming or removal).