Mohammad Naji
Mohammad Naji

Reputation: 5442

TinyMCE strips inline style with valid-elements: *[*] with Codeigniter

I have read Tinymce strips attributes on submit, TinyMce Allow all Html tag, TinyMCE valid elements: only allow specific CSS rules, how to prevent tinymce from stripping the 'style' attribute from input element?, TinyMCE, allow data attribute and many others...

But none of them work.

This is my code:

valid_elements : '+*[*]',
cleanup: false,
inline_styles : true

I have also tried

valid_elements : '*[*]'

(without + before *[*])

and even

valid_children : '+body[style]'

But when I add the styles manually like style="color: #fff;" and submit the form, TinyMCE removes the returned output.

In other words: I want TinyMCE to stop 'removing' any code automatically.

Upvotes: 5

Views: 3405

Answers (1)

Mohammad Naji
Mohammad Naji

Reputation: 5442

No, it was not TinyMCE that was preventing inline styles.

CodeIgniter did that.

Even now that I had manually disabled XSS filtering using:

$body = $this->input('body', FALSE);

, that was still being removed because I had enabled XSS filtering in application/config/config.php:

$config['global_xss_filtering'] = TRUE;

But when I changed it to

$config['global_xss_filtering'] = FALSE;

the problem was resolved and I got rid of the Server Side filtering.


I post the answer here and I hope no one else be such crazy and mad that I became!

Upvotes: 11

Related Questions