WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#16086 closed defect (bug) (wontfix)

TinyMCE inserts blank lines after paragraph with image with caption

Reported by: gerobe Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: TinyMCE Keywords: reporter-feedback
Focuses: Cc:

Description

TinyMCE inserts blank lines with a nobreaking space entity after paragraph with image with caption.

This happens, when the text starts right after the last caption

Example:

[caption id="attachment_6120" align="alignleft" width="220" caption="Caption under image"]<img class="size-medium wp-image-6120" title="title" src="http://www.domain.com/wp-content/images/image.jpg" alt="alt text" width="220" height="165" />[/caption]First paragraph with some text.

Second paragraph with some text.

becomes

[caption id="attachment_6120" align="alignleft" width="220" caption="Caption under image"]<img class="size-medium wp-image-6120" title="title" src="http://www.domain.com/wp-content/images/image.jpg" alt="alt text" width="220" height="165" />[/caption]

First paragraph with some text.

&nbsp;

Second paragraph with some text.

after switching to visuell and back to HTML in the editor.

Attachments (1)

16086.diff (528 bytes) - added by greuben 4 years ago.
quick fix

Download all attachments as: .zip

Change History (10)

comment:1 Ipstenu4 years ago

I can't reproduce this.

No matter how I try to put in a post (either starting with visual or html, and bouncing back and forth, saving in between), I never get extra &nbsp;

comment:2 duck_4 years ago

  • Keywords reporter-feedback added; tinymce editor removed

Probably a browser specific issue with TinyMCE.

comment:3 gerobe4 years ago

This happens on Win7 with Firefox 3.6.13 and Safari

comment:4 jane4 years ago

There are a number of "lost formatting" issues with TinyMCE that occur if you switch back and forth between the Visual and HTML tabs.

comment:5 greuben4 years ago

I was checking tiny_mce_src.js from its nightly build, saw some todo( commented out code ).

// Use BR instead of &nbsp; padded P elements inside editor and use <p>&nbsp;</p> outside editor
/*
if (o.set)
	h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p><br /></p>');
else
	h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p>$1</p>');
*/

// Since Gecko and Safari keeps whitespace in the DOM we need to
// remove it inorder to match other browsers. But I think Gecko and Safari is right.
// This process is only done when getting contents out from the editor.


I guess it is the expected behavior.

greuben4 years ago

quick fix

comment:6 greuben4 years ago

Attached a quick fix, just in case. I'm not much familiar with tiny mce so not touching it.

comment:7 ocean904 years ago

  • Component changed from General to TinyMCE

comment:8 koopersmith3 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

Since this is expected behavior (with minimal ramifications, and likely some benefit), we should stick with the TinyMCE implementation.

Last edited 3 years ago by koopersmith (previous) (diff)

comment:9 nacin3 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.