Question

I'm using tinymce which applies inline css for text colour etc. My issue is, if I apply colour change to some text tinymce produces the following:

<p><span style="color: #ff0000;">asdf</span></p>

When I save this reply:

reply = current_user.reply_to_sender(receipt[messageIndex], params[:body])  

... and check the database it has:

<p><span>asdf</span></p>

If I simply print params[:body] everything is fine, it's just the result of the save

Am I missing something here. I tried this without tinymce i.e. just put the html directly into a textarea with the same results so it's not tinymce.

Also I have tinymce in other areas of my app and it works fine with the same code

Was it helpful?

Solution

Turns out that it's down to the default behaviour of the reply_to_sender method in Mailboxer where sanitize_text is set to true

(Object) reply_to_sender(receipt, reply_body, subject = nil, sanitize_text = true, attachment = nil)

changing my method call to the following fixed this:

reply = current_user.reply_to_sender(receipt[messageIndex], params[:body], nil, false, nil)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top