Retain script tags in editor if allowed (fixes #3611)

TinyMCE strips them by default, but if they're specifically added
to the allowed elements we should respect that setting.

Example PHP config:
$validEls = HtmlEditorConfig::get('cms')->getOption('extended_valid_elements');
$validEls .= ',script[src|type]';
HtmlEditorConfig::get('cms')->setOption('extended_valid_elements', $validEls);
This commit is contained in:
Ingo Schommer 2014-11-10 22:30:00 +13:00 committed by Loz Calver
parent bb15307a8f
commit fb9753ddc4

View File

@ -70,7 +70,16 @@
+ '[/embed]';
el.replaceWith(shortCode);
});
o.content = jQuery('<div />').append(content).html(); // Little hack to get outerHTML string
// Insert outerHTML in order to retain all nodes incl. <script>
// tags which would've been filtered out with jQuery.html().
// Note that <script> tags might be sanitized separately based on editor config.
o.content = '';
content.each(function() {
if(this.outerHTML !== undefined) {
o.content += this.outerHTML;
}
});
});
var shortTagRegex = /(.?)\[embed(.*?)\](.+?)\[\/\s*embed\s*\](.?)/gi;