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]"

Share:
47,607
E-A
Author by

E-A

Updated on September 30, 2020

Comments

  • E-A
    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.
    sw. over 11 years
    I 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
    LeftyX about 11 years
    @sw. you mean valid_elements : '+*[*]',
  • sw.
    sw. about 11 years
    @LeftyX yes, sorry. It was valid_elements, no value_elements.
  • eozzy
    eozzy over 9 years
    I added this but it still strips doctype, html and head
  • Thariama
    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
    eozzy over 9 years
    I moved style tags inside body and using @import but still the files are not loaded
  • Thariama
    Thariama over 9 years
    @3zzy: how did you do that - can i show me the code you used?
  • Ben Racicot
    Ben Racicot about 9 years
    Yes, style tags are being stripped with this.
  • Deepti Kakade
    Deepti Kakade about 9 years
    how to keep <style></style> tag in tinyMCE because its removing the <style> tag
  • dmcontador
    dmcontador over 8 years
    Until a better option is offered, I generate the style tags with Javascript: <script>// <![CDATA[ document.write('<style>#jiji{color: red;}</style>'); // ]]></script>
  • MC9000
    MC9000 over 3 years
    still removes anchor tags with onclick (or any javascript).