[wp-trac] [WordPress Trac] #18311: Support HTML in image captions.

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 21 18:36:16 UTC 2012


#18311: Support HTML in image captions.
-------------------------------------+-----------------------
 Reporter:  prettyboymp              |       Owner:  sushkov
     Type:  task (blessed)           |      Status:  assigned
 Priority:  normal                   |   Milestone:  3.4
Component:  General                  |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch ux-feedback  |
-------------------------------------+-----------------------

Comment (by sushkov):

 I'm playing around with some escaping options, and the most elegant
 (chances are that it is not the most supported) solution is to use
 `JSON.stringify()` and `JSON.parse()`.

 `JSON` is a native JSON encoding/decoding browser feature with IE6> cross-
 browser support [1]

 Other ideas include `encodeURIComponent()` on JS side and `urldecode()`.
 We can't use `escape()` since there's no straight alternative to decode
 escaped strings on the PHP side (try this with languages like Tamil[2])

 The biggest problem though, is that we will need to filter what tags are
 supported in the caption, where I would stick to basic
 `span,a,em,strong,del,[insert markup tags here]` (could not find a reason
 why would someone insert a `<table>` in a caption). For this we will
 definitely need a textarea instead of existing input type field and a UI
 markup editor, which is an unanswered question atm (both MCE and quicktags
 do not fit, unless we leave textarea use plain HTML).

 Need some dev feedback.

 [1]:
 http://en.wikipedia.org/wiki/JSON#Native_encoding_and_decoding_in_browsers
 [2]: http://en.wikipedia.org/wiki/Tamil_language

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18311#comment:23>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list