0
votes

I would like to setup TinyMCE to allow literally any HTML without any cleaning whatsoever. I have tried mirriads of different settings, yet none of them eventually satisfied my needs.

I also need to have an option to make TinyMCE strip any styling from pasted text, and just leave the Ps and the ULs et cetera.

2

2 Answers

1
votes

Question 1: This is a big expectation. Remember that the editor has to edit the content. It's a lot to expect it to handle anything a user might paste in and then edit it (bold, underline, indent) correctly. The editor is doing its own cleanup to make the content slightly sane.

Question 2: use the 'valid elements' option. http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

probably something like valid_elements: 'p,ul,li'

1
votes

I think you need to alter your submitted content to allow for that.

if using PHP try http://php.net/htmlentities with ENT_QUOTES

what that will do will convert your html into safe to use chars/quotes

ie, this markup

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>

<body>
<p>hello world</p>

</body>
</html>

Would become this markup.

<p>&lt;!DOCTYPE HTML&gt;<br />&lt;html&gt;<br />&lt;head&gt;<br />&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;<br />&lt;title&gt;Untitled Document&lt;/title&gt;<br />&lt;/head&gt;<br /><br />&lt;body&gt;<br />&lt;p&gt;hello world&lt;/p&gt;<br /><br />&lt;/body&gt;<br />&lt;/html&gt;</p>