Is there a way to get TinyMCE V4 to not remove <style>
tags.
tinymce.init({
selector: 'textarea.tinymce',
theme: 'modern',
plugins: [
'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker',
'searchreplace wordcount visualblocks visualchars code insertdatetime media nonbreaking',
'save table contextmenu directionality emoticons template paste textcolor'
],
valid_elements: '+*[*]',
width: '100%',
inline_styles: true,
keep_styles: true,
extended_valid_elements: '+*[*]',
custom_elements: '*',
invalid_elements: '',
verify_html: false
});
I want to be able to add any HTML I want whether valid or not. I don’t care if it is a fork or a workaround.
You can use TinyMCE's valid_children
option for that:
valid_children : '+body[style]',
Check this fiddle for a complete example.
The valid_children
enables you to control what child elements can exists within specified parent elements.
Define style
and link
as a custom tag to keep them:
tinymce.init({
...
extended_valid_elements:"style,link[href|rel]",
custom_elements:"style,link,~link"
...
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With