[wp-trac] [WordPress Trac] #23280: TinyMCE issue with table wrapped with shortcode

WordPress Trac noreply at wordpress.org
Fri Feb 21 10:59:45 UTC 2014


#23280: TinyMCE issue with table wrapped with shortcode
--------------------------+------------------------------
 Reporter:  wpweaver      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  TinyMCE       |     Version:  3.5
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Description changed by ocean90:

Old description:

> TinyMCE will generate unbalanced <p> tags when a table is included as the
> content of a wrapping style shortcode. In this example, assume a
> shortcode called `[div] ... [/div]` that simply brackets the content with
> a `<div> ... </div>`.
>
> This is an example as it would be in the editor's Text view (and it works
> if you switch back and forth to Visual.):
>
> -----------------
> {{{
> There will be a table following.
>
> [div]
> <table>
> <tbody>
> <tr>
> <td>Simple table</td>
> </tr>
> </tbody>
> </table>
> [/div]
>
> Next line is here.
> }}}
> ------------------------
> The HTML output generated is this:
>
> {{{
> <p>There will be a table following.</p>
> <div></p>
> <table>
> <tbody>
> <tr>
> <td>Simple table</td>
> </tr>
> </tbody>
> </table>
> <p></div>
> <p>Next line is here.</p>
> }}}
> ------------
> The shortcode is very simple - just a demo. It returns simply:
>
> {{{
> return '<div>' . do_shortcode($text) . '</div>';
> }}}
>
> Doesn't seem to matter with or without the do_shortcode() call.
> --------
>
> So note the excess </p> after the added starting <div>, and the extra <p>
> before the </div> from the shortcode. Seems to happen only with a
> wrapping style shortcode, and I think only with tables.

New description:

 TinyMCE will generate unbalanced <p> tags when a table is included as the
 content of a wrapping style shortcode. In this example, assume a shortcode
 called `[div] ... [/div]` that simply brackets the content with a `<div>
 ... </div>`.

 This is an example as it would be in the editor's Text view (and it works
 if you switch back and forth to Visual.):

 -----------------
 {{{
 There will be a table following.

 [div]
 <table>
 <tbody>
 <tr>
 <td>Simple table</td>
 </tr>
 </tbody>
 </table>
 [/div]

 Next line is here.
 }}}
 ------------------------
 The HTML output generated is this:

 {{{
 <p>There will be a table following.</p>
 <div></p>
 <table>
 <tbody>
 <tr>
 <td>Simple table</td>
 </tr>
 </tbody>
 </table>
 <p></div>
 <p>Next line is here.</p>
 }}}
 ------------
 The shortcode is very simple - just a demo. It returns simply:

 {{{
 add_shortcode( 'div', function( $atts, $content ) {
         return '<div>' . do_shortcode( $content ) . '</div>';
 } );
 }}}

 Doesn't seem to matter with or without the do_shortcode() call.
 --------

 So note the excess </p> after the added starting <div>, and the extra <p>
 before the </div> from the shortcode. Seems to happen only with a wrapping
 style shortcode, and I think only with tables.

--

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


More information about the wp-trac mailing list