mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
bb15307a8f
commit
fb9753ddc4
@ -70,7 +70,16 @@
|
|||||||
+ '[/embed]';
|
+ '[/embed]';
|
||||||
el.replaceWith(shortCode);
|
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;
|
var shortTagRegex = /(.?)\[embed(.*?)\](.+?)\[\/\s*embed\s*\](.?)/gi;
|
||||||
|
Loading…
Reference in New Issue
Block a user