Write: fix empty heading and blockquote block markup in convertToBlocks#48544
Write: fix empty heading and blockquote block markup in convertToBlocks#48544
Conversation
… block markup Empty headings and blockquotes inserted via slash commands carried a contentEditable <br> placeholder into Gutenberg block markup, causing block validation failures. Strip the placeholder before the empty-content check so these blocks are cleanly skipped. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
…ocks() Instead of skipping empty blocks entirely, serialize them as valid empty Gutenberg blocks to match how the block editor handles empty content. Empty paragraphs are still skipped as they are typically whitespace noise. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixes RSM-2297
Proposed changes
<br>placeholders frominnerHTMLinconvertToBlocks()before the empty-content check — these are left by contentEditable for focus but produce invalid Gutenberg block markup<li>children get a single empty list item to produce valid markupRelated product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
/headingand press Enter to insert an empty heading — do not type any text into it/quoteand press Enter to insert an empty blockquote — do not type any text into itCo-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com