Make WordPress Core

Opened 3 years ago

Last modified 6 weeks ago

#23280 closed defect (bug)

TinyMCE issue with table wrapped with shortcode — at Version 2

Reported by: wpweaver Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Shortcodes Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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.

<td>Simple table</td>

Next line is here.

The HTML output generated is this:

<p>There will be a table following.</p>
<td>Simple table</td>
<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.

Change History (2)

comment:1 @wpweaver3 years ago

  • Cc weaver@… added
  • Component changed from Editor to TinyMCE

comment:2 @SergeyBiryukov3 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.