Make WordPress Core

Opened 10 years ago

Last modified 5 years ago

#27076 new defect (bug)

double newlines inserted before captions

Reported by: arupqfjm's profile arupqfjm Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.6
Component: Editor Keywords: dev-feedback has-patch needs-testing
Focuses: ui, javascript, administration Cc:


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' );

Attachments (1)

27076.diff (647 bytes) - added by arupqfjm 10 years ago.

Download all attachments as: .zip

Change History (6)

#1 @SergeyBiryukov
10 years ago

  • Version changed from 3.8.1 to 2.6

Introduced in [8239]. Related: [8260], [8313].

#2 @arupqfjm
10 years ago

  • Focuses ui javascript administration added
  • Keywords dev-feedback ui-feedback ux-feedback added

#3 @arupqfjm
10 years ago

  • Keywords has-patch added

10 years ago

#4 @arupqfjm
10 years ago

  • Keywords needs-testing added

#5 @chriscct7
9 years ago

  • Keywords ui-feedback ux-feedback removed
Note: See TracTickets for help on using tickets.