WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 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 10 years ago.
quick fix

Download all attachments as: .zip

Change History (10)

#1 @Ipstenu
10 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;

#2 @duck_
10 years ago

  • Keywords reporter-feedback added; tinymce editor removed

Probably a browser specific issue with TinyMCE.

#3 @gerobe
10 years ago

This happens on Win7 with Firefox 3.6.13 and Safari

#4 @jane
10 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.

#5 @greuben
10 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.

@greuben
10 years ago

quick fix

#6 @greuben
10 years ago

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

#7 @ocean90
10 years ago

  • Component changed from General to TinyMCE

#8 @koopersmith
10 years ago

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

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

Version 0, edited 10 years ago by koopersmith (next)

#9 @nacin
10 years ago

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