-
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
Convert to blocks: upgrade and remove spans if possible #62659
base: trunk
Are you sure you want to change the base?
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: +93 B (+0.01%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
Flaky tests detected in dcc35e8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9567502817
|
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.
tests on the Editor with various content elements pass
...<li style="list-style-type: none;">dirty item</li>...
<span style="font-weight: 400">Some content</span>
@@ -0,0 +1,25 @@ | |||
export default function anchorReducer( node ) { |
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've found that list items having spans are not processed well. The conversion results to To handle these cases I've created custom |
What?
The idea behind "convert to blocks" (compared to past handling) is to preserve content as much as possible. However, at the moment, we are preserving it a bit too much.
strong
.em
.b
should be converted tostrong
.i
should be converted toem
.I've separated out the anchor reducer to only run on paste (because it modifies content).
Why?
We have core formats for these, which is a better experience.
Spans that do nothing leads to a bad user experience.
How?
Testing Instructions
I've added an integration test.
Paste this in the code editor.
Switch to visual and click "convert to blocks". There should be no spans.
Testing Instructions for Keyboard
Screenshots or screencast