[wp-trac] [WordPress Trac] #13288: Shortcodes getting wrapped with a "p" tag by rich editor

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 29 17:06:35 UTC 2012


#13288: Shortcodes getting wrapped with a "p" tag by rich editor
--------------------------+----------------------
 Reporter:  aizatto       |       Owner:  azaozz
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Shortcodes    |     Version:
 Severity:  normal        |  Resolution:  wontfix
 Keywords:                |
--------------------------+----------------------

Comment (by azaozz):

 For TinyMCE a shortcode is just a text string like any other text entered
 by the user. It's actually better to have it wrapped in a <p> as it's
 displayed correctly, either as a separate block or inline with other text.

 If a TinyMCE plugin wants to do something with that shortcode in the
 editor, like image captions or [gallery], it can replace the whole DOM
 node or insert content in it.

 When saving all <p> are replaced with two line breaks. The saved content
 is exactly like in the HTML (Text) editor, so there is no need for
 separate shortcode processing.

 The only time this is a problem is when wpautop() is not used. Then the
 <p> aren't replaced on save (the content is saved in the db with all html
 tags intact). But this is strictly a plugin material for now. These
 plugins can either run shortcode_unautop() on saving the content or leave
 it running on display (the default).

 A way to make this easier would be to pass whether wpautop was used to PHP
 on saving. This can include a flag whether the content was taken from
 TinyMCE or directly from the textarea.

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


More information about the wp-trac mailing list