Opened 11 years ago
Last modified 6 years ago
#27076 new defect (bug)
double newlines inserted before captions
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.6 |
Component: | Editor | Keywords: | dev-feedback has-patch needs-testing |
Focuses: | ui, javascript, administration | Cc: |
Description
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)
Change History (6)
Note: See
TracTickets for help on using
tickets.
Introduced in [8239]. Related: [8260], [8313].