-
Notifications
You must be signed in to change notification settings - Fork 4.5k
RawHTML: Clarify the wrapper 'div' element behavior #70527
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
Conversation
Size Change: 0 B Total Size: 1.86 MB ℹ️ View Unchanged
|
Component used as equivalent of Fragment with unescaped HTML, in cases where it is desirable to render dangerous HTML without needing a wrapper element. To preserve additional props, a `div` wrapper _will_ be created if any props aside from `children` are passed. | ||
Component used to render unescaped HTML. | ||
|
||
Note: The `renderElement` serializer will remove the `div` wrapper unless non-children props are present; typically when preparing a block for saving. |
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'm not sure if that is clear enough. The way I understand it, there will be always a div
wrapper. The only exception is when seralizing the block and there are no props provided, the content will be rendered as is.
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.
Maybe, we could also include an example with the result:
const Component = () => <RawHTML><h3>Hello world</h3></RawHTML>;
// Edit: <div><h3>Hello world</h3></div>
// save: <h3>Hello world</h3>
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.
Yeah, tried my best not to sound too technical, and this is the best I could come up with 😅
I'll include code example 👍 Done in 1c5365b.
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. |
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.
Looks good to me.
Thanks for the feedback, @gziolo 🙇 |
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: gziolo <gziolo@git.wordpress.org> Co-authored-by: USERSATOSHI <tusharbharti@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: philipjohn <philipjohn@git.wordpress.org>
Thank you @Mamaduka ! |
What?
Closes #70349
PR clarifies the wrapper
div
behavior inRawHTML
component.Testing Instructions
None. It's just a documentation update.