Download & Extend

TinyMCE Serializer strips allowed and valid HTML

Project:Wysiwyg
Version:7.x-2.x-dev
Component:Editor - TinyMCE
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)

Issue Summary

Hi,
I am trying to write some simple script tags into my *HTML* editor. I paste in something like;

<p><script src="foo.js"></script></p>

When I save the node, I am back in the Filtered HTML view, and I can verify the tinymce content is gone with:

tinyMCE.activeEditor.getContent({format:'raw'});

I have allowed all elements in the extended_valid_elements object from within my custom plugin:

$settings['extended_valid_elements'] = "*[*]";

I have narrowed this down to the code within the tinyMCE Serializer:

Lines 14431-14434 in tiny_mce_src.js (v3.5.8):

// Parse and serialize the html
        if (args.format !== 'raw') {
          content = new tinymce.html.Serializer({}, self.schema).serialize(
            self.parser.parse(content)
          );
        }

Does anyone know of a way to get tinyMCE to NOT strip out my code?

Thanks!!

Comments

#1

Status:active» postponed (maintainer needs more info)

Does this only happen when using TinyMCE with Wysiwyg?
Does it only happen in some browsers?

It works fine for me on http://www.tinymce.com/tryit/full.php in Chrome.

If only under Wysiwyg, try disabling the Teaser Break plugin or any other plugins belonging to Drupal modules. Wysiwyg passes content through it after TinyMCE has generated the final markup, but it's known to mess up some HTML (especially in any version of IE) and remove some tags because it uses the browser's functions to manipulate the contents as a DOM.

I have previously noticed that TinyMCE on its own will strip script tags if they are placed inside div tags, see #1454564-3: Tinymce strips Javascript.

If there's an error inside TinyMCE itself there's nothing we can do about it in Wysiwyg module, you'll have to create a bug report on their site.