syntaxhighlighter icon indicating copy to clipboard operation
syntaxhighlighter copied to clipboard

Bugfix for Shortcode content gets injected with pre tags by tinymce

Open ghost opened this issue 11 years ago • 0 comments

Description:

Shortcodes get injected with pre tags by tinymce when block-level html is included.

Steps to reproduce:

  1. Create a post
  2. In the text tab of tiny mce add a SH shortcode with an h1 (or any block-level tag) in it.
  3. Save the post
  4. After page reload, switch to the visual tab (to see the visual affect of injected pre tags)
  5. Switch back to the text tab ( to see injected code )

Example short code [html]<h1>This is an h1</h1>[html]

Expected output:

The user should be able to switch tiny mce modes (text/visual) and the content should not have code injected at the very least.

Actual Output:

Since SH passes unescaped html to the editor and wraps the shortcode in pre tags, tiny mce breaks up the shortcode in to segments injecting closing and opening pre tags to exclude the block level element from the pre content.

Tested with: WordPress 3.6-beta3-24430

ghost avatar Jun 07 '13 22:06 ghost