Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE - Completely disable validation

Tags:

tinymce

n2cms

I'm using N2CMS which in turn uses TinyMCE to edit HTML content.

what i need to do is disable the TinyMCE HTML validation completely.

Its stripping out anything out that doesn't adhere to its settings.

If I add a custom attribute <a href="{0}" test="tester1" /> it just removes it the custom attribute!

also, it always add <p> tags around every bit of HTML content.

how can i disable the validation?

any help is very much appreciated.

like image 506
JGilmartin Avatar asked Aug 14 '11 17:08

JGilmartin


2 Answers

to resove this, add these into the tinyMCE settings, or init

    cleanup_on_startup: false,
    trim_span_elements: false,
    verify_html: false,
    cleanup: false,
    convert_urls: false
like image 70
JGilmartin Avatar answered Sep 18 '22 02:09

JGilmartin


There are a relatively large number of TinyMCE options related to cleaning up and validating HTML.

The valid_elements or extended_valid_elements option can definitely help you with custom attributes:

extended_valid_elements: "a[href|test]",

That option would specifically allow href and test attributes on anchor tags per your example.

As far as your second question is concerned, could you please clarify? Are you asking how to avoid escaping HTML code that is pasted into the WYSIWYG editor or are you asking how to avoid wrapping text in paragraph or div tags?

like image 28
Thomas Upton Avatar answered Sep 20 '22 02:09

Thomas Upton