WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#36165 closed defect (bug) (fixed)

HRs insert non-breaking into the editor (only viewable from text mode)

Reported by: melchoyce Owned by: azaozz
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.6
Component: TinyMCE Keywords:
Focuses: administration Cc:

Description

When you insert a horizontal rule (<hr />) into your post or page using the toolbar button, it also inserts a non-breaking space (&nbsp;) right after it. The only way to delete this is to flip into the text editor and manually erase it.

Attachments (1)

hr.mp4 (2.8 MB) - added by melchoyce 6 years ago.

Change History (7)

@melchoyce
6 years ago

#1 @azaozz
6 years ago

  • Milestone changed from Awaiting Review to Future Release

Confirmed. Every time HR is inserted above a block element other than a paragraph, it inserts a new empty paragraph under the HR and places the caret in it. This is not WordPress specific, happens in the full featured TinyMCE demo: https://www.tinymce.com/docs/demo/full-featured/.

Passing this upstream. In the meantime a workaround is to press backspace when this happens. That will remove the unwanted empty paragraph.

#2 @melchoyce
6 years ago

Passing this upstream.

Thanks @azaozz!

In the meantime a workaround is to press backspace when this happens. That will remove the unwanted empty paragraph.

When I do that it deletes the HR. Only workaround I've found is to manually delete in the text tab. :/

#3 @azaozz
6 years ago

When I do that it deletes the HR.

Yeah, doesn't always work. There's more: if you insert a HR while the caret is in a heading tag, it creates an empty heading after the HR. So having a look in the Text editor seems the best thing for now.

#4 @azaozz
6 years ago

This was fixed in TinyMCE 4.3.8, see #36254, except one edge case: if the caret is at the end of inline tag (like <b>, <i>, etc.), that is at the end of a paragraph, the inline tag still gets split, then wrapped in a <p>. Later the empty inline tag gets removed, but the <p> remains.

Last edited 6 years ago by azaozz (previous) (diff)

#5 @azaozz
6 years ago

  • Milestone changed from Future Release to 4.5
  • Version set to trunk

This edge case is fixed with https://github.com/tinymce/tinymce/commit/b1618d1adb57df992ee69907b1cfff9aa4d53c80. We can backport that and close this ticket for 4.5.

#6 @azaozz
6 years ago

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

In 37074:

TinyMCE: include the upstream fix for inserting <hr> while the caret is in an inline element: https://github.com/tinymce/tinymce/commit/b1618d1adb57df992ee69907b1cfff9aa4d53c80.

Fixes #36165.

Note: See TracTickets for help on using tickets.