-
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
Flaky tests detected in 423d892. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11896127808
|
@@ -40,3 +36,18 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before | |||
background: rgb(255, 255, 0); | |||
} | |||
} | |||
|
|||
[data-rich-text-comment], |
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.
What is this attribute about?
|
||
[data-rich-text-comment], | ||
[data-rich-text-format-boundary] { | ||
border-radius: 2px; |
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.
Why not $radius-small like before?
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