Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 848
Mohammad Naji Avatar asked Oct 20 '12 20:10

Mohammad Naji


1 Answers

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!

like image 160
Mohammad Naji Avatar answered Nov 13 '22 09:11

Mohammad Naji