-
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
Rich text: preserve comments #62128
base: trunk
Are you sure you want to change the base?
Rich text: preserve comments #62128
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. |
Size Change: +224 B (+0.01%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
7fca390
to
98f3290
Compare
What?
Extracted from #60735.
Fixes #13318.
This PR preserves HTML comments in rich text. Currently they are stripped out when HTML is parsed by rich text.
Why?
We should leave the content intact and interfere as little as possible. While useful on its own (and fixing a bug), this is also a preparatory PR for Bits, as it will make use of comments to anchor dynamic content inline. In the editor, the comment will then be replaced through an API by either a placeholder or the data.
How?
Rich text uses the browser's HTML parser, so it's quite easy to store this internally.
Testing Instructions
Insert a comment in a paragraph (through the code/HTML editor) and switch back to visual. There should be a placeholder. Edit the paragraph, and the placeholder/comment should remain.
Testing Instructions for Keyboard
Screenshots or screencast