[wp-trac] [WordPress Trac] #28419: tinyMCE breaking quotes in Wordpress editor

WordPress Trac noreply at wordpress.org
Tue Jun 3 00:00:41 UTC 2014


#28419: tinyMCE breaking quotes in Wordpress editor
--------------------------+-------------------------
 Reporter:  stewarttodd   |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  TinyMCE       |     Version:
 Severity:  normal        |  Resolution:  worksforme
 Keywords:                |     Focuses:
--------------------------+-------------------------
Changes (by azaozz):

 * status:  new => closed
 * version:  3.9.1 =>
 * resolution:   => worksforme
 * milestone:  Awaiting Review =>


Comment:

 Hi stewarttodd,

 In TinyMCE shortcodes are simple text strings (unless there is some
 special treatment). HTML tags inside a shortcode attribute are rendered as
 "standard" HTML.

 In your example once the `<a>` tag becomes a DOM node, it's not easy (and
 pretty much pointless) to try and remember what type of quotes were used
 initially. When the DOM is serialized, all HTML attributes are wrapped in
 double quotes.

 There are several ways to work around this issue:
 - Escape any HTML tags in shortcode attributes, i.e. replace <, >, &, ",
 with entities.
 - Use single quotes for shortcode attributes that contain HTML.
 - Store the HTML as a content of the shortcode, i.e. wrapped by `[...]`
 and `[/...]`.
 - Replace the shortcode with a placeholder image. Then the actual
 shortcode string can be stored as an encoded attribute on the image tag
 (see [gallery] and wpView).

 Closing as worksforme. Feel free to reopen if there is a better way to
 handle this (preferably with an example patch).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28419#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list