WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#23139 closed defect (bug) (duplicate)

Insert/Edit Link adds unwanted paragraph when the link takes up the entire paragraph

Reported by: JboyJW Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: TinyMCE Keywords: needs-patch
Focuses: Cc:

Description

In the TinyMCE editor, select an entire paragraph of text and click the Insert/Edit Link button. Enter a URL or select a page and Insert Link. Look at the resulting HTML(Text) view now. You'll see that the link tag has surrounded the entire paragraph so that it look like this:

<a href="testurl">Test

</a>

The HTML should simply be
<a href="testurl">Test</a>

If you update the page without looking at the HTML view, it produces extra spacing when you actually view the page. The resulting HTML of the live page in Chrome looks like:

<p><a href="testurl">Test</p>
<p></a></p>

The only way to get rid of the extra spacing is to manually edit the HTML in the TinyMCE editor and Update again. Certainly not ideal for the average WordPress user.

Change History (3)

#1 @MikeHansenMe
5 years ago

  • Cc mdhansen@… added
  • Keywords needs-patch added

I was able to confirm this. I added the code sample from above and published. When viewing the page on the site is shows

<p> <a href="testurl">Test</p>
<p></a> </p>

This change does not show in the editor only on the front end.

#3 @azaozz
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #22888, already fixed for 3.5.1.

Note: See TracTickets for help on using tickets.