#7943 closed defect (bug) (wontfix)
Image captions truncated if single quotes are added in the html editor
Reported by: | designsimply | Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | minor | Version: | 2.6 |
Component: | Media | Keywords: | needs-patch |
Focuses: | Cc: |
Description
When adding captions with single or double quotes (if edited in HTML editor mode), saving or returning to visual editor mode truncates the caption.
To reproduce:
- Open a new post
- Insert an image with a caption
- Switch to HTML editor
- Modify caption to include a single quote or a double quote (i.e. it's the bestest caption ever! or hi "there")
- Switch back to Visual editor and the caption will be truncated
I was able to reproduce this on Safari 3.1.2, Firefox 3.0.3, and Firefox 2.0.0.16 on Mac OS X Leopard.
Change History (10)
#2
@
16 years ago
In the HTML editor single and double quotes have to be entered as HTML entities, this happent automatically in the Visual editor (so it works when entered there).
For now the caption doesn't support HTML tags, only text. Support for inline tags is planned but probably will be ready after 2.7.
#4
@
16 years ago
- Milestone changed from 2.8 to Future Release
Punting due to feature freeze. Reconsider with next release.
#5
@
16 years ago
- Component changed from General to Media
- Owner anonymous deleted
- Priority changed from normal to low
- Severity changed from normal to minor
confirming there are a few genuine bugs in there. but nothing that prevents things from working.
try an image with the caption:
it's a "caption"
- insert in wysiwyg, go back and forth
- insert in html instead, go back and forth
the text gets inconsistently processed/reprocessed. things do work. it might just confuse some users.
#8
@
16 years ago
The problem is not restricted to the html/visual editor because a caption short code with escaped double quotes in the caption parameter appears to break the shortcode parser.
The result of an image inserted with a caption that contains one or more double quotes (escaped or not) will be published without the caption div or caption paragraph surrounding the html image and link. Implying the shortcode failed to generate any output code.
Although it would be possible to use "s in the caption text in the media library forms, it isn't reasonable to expect normal users to do this.
The solution is to alter the "insert into post" code to convert quotes to entities just prior to doing the addslashes.
The bug also makes it impossible to have elements having attributes alike a link inside the image caption. Which, I think, increments the piority.
Eg. '<a href=""></a>' breaks at the first quoute as designsimply says.
Cause
The caption is written using the 'new' shortcodes. The format caption="" format seems to support escaped quotes (\") but I'm not certain about that.
Using the HTML editor I escaped the quotes manually which makes the link or quoute correctly until the post is saved/published.
Hopeful this bit of information can help you out.
It is a code problem, so testing more web browsers is irrelevant.