Opened 7 months ago
Closed 7 months ago
#22459 closed defect (bug) (fixed)
Inserting captionless and captioned image together causes shortcode to appear in visual mode
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Media | Version: | 3.5 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: |
Description
- select an image with no caption
- select an image with a caption
- batch-insert into post
The [caption] shortcode will appear in the visual editor.
Change History (4)
comment:1
SergeyBiryukov
— 7 months ago
- Milestone changed from Awaiting Review to 3.5
comment:3
koopersmith
— 7 months ago
- Keywords needs-patch added
The wpeditimage plugin searches for captions by checking if the inserted string begins with [caption. With multiple images, we're inserting a single string, which is causing the issue here. Instead, we should be inserting multiple strings.
This can be fixed by going into media-upload.js and changing the insert event callback to use each instead of map, and moving the call to insert into the loop.
comment:4
koopersmith
— 7 months ago
- Owner set to koopersmith
- Resolution set to fixed
- Status changed from new to closed
In 22672:
Note: See
TracTickets for help on using
tickets.
It seems like it's generating the HTML in media-upload.js, around line 368-372, where the code is directly inserted inside of the Visual editor and not evaluated or hidden (and visible only in the Text version).