TinyMce Allow all Html tag
47,607
Solution 1
You can set
valid_elements : '*[*]',
to allow all html tags.
Solution 2
To keep style tags, use valid_children : "+body[style]"
Author by
E-A
Updated on September 30, 2020Comments
-
E-A over 3 years
I'm using TinyMce and even though the danger of a script attack, I need to enable all html tags with the editor.
Currently, I'm use like:
valid_elements: "@[class],p[style],h3,h4,h5,h6,a[href|target],strong/b," + "div[align],br,table,tbody,thead,tr,td,ul,ol,li,img[src]"
But always need to add something, I want to enable ALL HTML tags with all attributes. Is there such switch that Disables the HTML filtering?
-
sw. over 11 yearsI am using a variant of this one: value_elements:'+*[*]', since the plus sign enables me to have tags without childrens. Like <i class="icon-ok"></i> in the context of the tinymce editor on a mezzanine/django/twitter-bootstrap combination.
-
LeftyX about 11 years@sw. you mean
valid_elements : '+*[*]',
-
sw. about 11 years@LeftyX yes, sorry. It was valid_elements, no value_elements.
-
eozzy over 9 yearsI added this but it still strips doctype, html and head
-
Thariama over 9 years@3zzy: doctype, html and head are no html tags that can be used under a BODY tag and are therefor removed by tinymce. The valid_elements definition is only applyable to html elements that can exist under a BODY tag.
-
eozzy over 9 yearsI moved style tags inside body and using @import but still the files are not loaded
-
Thariama over 9 years@3zzy: how did you do that - can i show me the code you used?
-
Ben Racicot about 9 yearsYes, style tags are being stripped with this.
-
Deepti Kakade about 9 yearshow to keep
<style></style>
tag in tinyMCE because its removing the<style>
tag -
dmcontador over 8 yearsUntil a better option is offered, I generate the style tags with Javascript:
<script>// <![CDATA[ document.write('<style>#jiji{color: red;}</style>'); // ]]></script>
-
MC9000 over 3 yearsstill removes anchor tags with onclick (or any javascript).