[wp-trac] [WordPress Trac] #27076: double newlines inserted before captions

WordPress Trac noreply at wordpress.org
Sun Feb 9 13:35:32 UTC 2014


#27076: double newlines inserted before captions
--------------------------+-----------------------------
 Reporter:  arupqfjm      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  3.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Steps to reproduce:
 - Upload some picture in the library and add some caption to it
 - Edit a post/page using the visual editor and, after some text, insert
 the picture using the add media button, so a "caption" shorttag is created
 - Go into text editing
 - Suppress the two newlines that appeared before the "caption" shorttag
 - Go into visual mode
 - Go into text mode: the newlines reappeared

 It is important to put something before the picture inserted in order to
 reproduce the bug, because the two newlines are not inserted if it is at
 the very beginning of a post/page.

 This is annoying for example in a table with top-aligned cells, if in a
 cell you have some text, and in the cell just to the right you have a
 "caption", then the two won't be aligned, since the newlines are converted
 to an empty paragraph during the rendering.

 From what I saw, the issue could be fixed by just removing the line n° 124
 in wp-admin/js/editor.js:
 {{{content = content.replace( /\s*\[caption([^\[]+)\[\/caption\]\s*/gi,
 '\n\n[caption$1[/caption]\n\n' );}}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27076>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list