-
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
Notices escape HTML tags #6292
Comments
This is expected behavior. The notices actions accept a WordPress element or plain-text string. If you must provide unescaped HTML, you can use the createSuccessNotice( createElement( RawHTML, null, '<script>alert( "My unsafe HTML" );</script>' ) ); |
@aduth Awesome, but this seems to trigger an error:
The first notice is displayed correctly, as HTML, then there are no more notices displayed (because of that error, I assume). FYI - some relevant code:
|
The error should be more graceful, but this is an issue of A simple workaround is to pass an object as the second argument, with a |
Are the notices actions documented anywhere or is there an existing issue to add that? |
No, though to notices specifically, I don't know that it's ultimately desirable for the notices state to live in the editor module, since it's a generally useful feature. Instead, I'd see notices being independent, and editor merely renders its exposed data-bound component. I created an issue at #6388 . Documentation of actions and selectors in general is still an open task. I created an issue at #6389. |
Gutenberg escapes HTML when displaying notices:
The text was updated successfully, but these errors were encountered: