Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#44308 closed defect (bug) (fixed)

TinyMCE: empty paragraphs are created from HTML comments on separate lines

Reported by: azaozz's profile azaozz Owned by: azaozz's profile azaozz
Milestone: 4.9.7 Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords: has-patch
Focuses: Cc:


Follow up from To test:

To fix this we will need to remove any line breaks from between HTML comments, and insert them again (when wpautop is disabled).

Attachments (1)

44308.patch (1.1 KB) - added by azaozz 6 years ago.

Download all attachments as: .zip

Change History (6)

6 years ago

#1 @azaozz
6 years ago

In 44308.patch:

  • Remove any white space between two or more HTML comments when wpautop is not used. Fixes a bug where TinyMCE may insert empty paragraph tags.
  • When saving, add back the two line breaks between HTML comments if they are Gutenberg block markers.

#2 @azaozz
6 years ago

  • Keywords has-patch needs-testing added

#3 @danielbachhuber
6 years ago

I've confirmed 44308.patch works as expected.

I've also confirmed the post content is saved to the database as expected:

$ wp post get 1 --field=content
<!-- wp:heading -->
<h2>This is a heading block</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>This is my paragraph text.</p>
<!-- /wp:paragraph -->

Does it make sense to land this in 4.9.7 or 4.9.8?

#4 @azaozz
6 years ago

  • Keywords needs-testing removed
  • Milestone changed from 5.0 to 4.9.7

Does it make sense to land this in 4.9.7

Think so. This is an edge case bugfix for HTML comments when wpautop is disabled in the editor.

#5 @azaozz
6 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 43336:

TinyMCE: prevent creation of paragraphs from multiple HTML comments when wpautop is disabled.

Fixes #44308.

Note: See TracTickets for help on using tickets.