Repository navigation
Conversation
…ions. In wp.editor.autop(), drop newlines immediately following protected <wp-temp-br> tags within [caption] shortcodes so line breaks are preserved accurately without duplicating upon switching editor tabs. Props therssoftware, yumiko.m. Fixes #66373.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Description
Addresses Trac ticket #66373.
In
wp.editor.autop()(src/js/_enqueues/wp/editor/base.js),<br />tags followed by a newline (such as<br />\nor<br>\n) inside[caption]shortcodes were being converted into<br /><br />.Root Cause
wp.editor.autop(),<br>tags inside captions are temporarily converted to<wp-temp-br>to protect them from standard paragraph splitting:<wp-temp-br />:<br />\nproduced two adjacent<wp-temp-br />tags (<wp-temp-br /><wp-temp-br />), which restored to<br /><br />. Each switch between the Visual and Text editor tabs doubled the number of<br>tags inside image captions.Solution
Drop whitespace and newlines immediately following
<wp-temp-br>tags before converting remaining standalone newlines into temporary breaks:Testing
tests/qunit/wp-admin/js/editor.jscovering:<br />\nand<br>\ninside captions.\r\n).<br>tags inside captions.<br>.wp.editor.autop()andwp.editor.removep()editor toggle cycles.editor.jsand tests intests/qunit/index.html.index.htmlandcompiled.html.Props: @therssoftware, @yumiko.m
Fixes #66373.