tinymce-rails icon indicating copy to clipboard operation
tinymce-rails copied to clipboard

Cannot update styles on rails 4

Open dinakaran opened this issue 11 years ago • 13 comments

Hi

I am using the tinymce-4 branch of this in my rails 4 application the problem is

when i update the styles in the editor the styles is not getting saved there is no errors from console

and following is my tinymce.yml configuration

* menubar: false
toolbar1: styleselect | bold italic | alignleft aligncenter alignright alignfull | bullist numlist outdent indent| table | link image
theme_advanced_toolbar_location: none
plugins:                  
    - table              
    - advlist           
    - lists
    - link
    - image
    - anchor
    - pagebreak                                                                                            

is there anything i need to provide

Thanks for your help

dinakaran avatar May 09 '14 07:05 dinakaran

Can you clarify what you mean by "when i update the styles in the editor the styles is not getting saved"?

spohlenz avatar May 25 '14 11:05 spohlenz

thanks spohlenz for answer:) for example if i applied h1 tag on the editor area on the edit page it is showing the h1 tag. but when i save the content the h1 tag is not appearing on the view template

dinakaran avatar May 26 '14 03:05 dinakaran

I have the same issue, basically. When I apply a font size or family in the editor and save my post, it shows up in my db as having been changed, but when I display it I don't get the changes.

markmohr15 avatar May 26 '14 04:05 markmohr15

When outputting the content in your template, you need to call html_safe on your content to ensure that the output is not escaped. e.g.

<%= @post.content.html_safe %>

spohlenz avatar May 26 '14 04:05 spohlenz

I tried that. I get bold or italics, but not the font or size.

markmohr15 avatar May 26 '14 04:05 markmohr15

Are the font size/family styles definitely being saved to the database? Is another !important CSS rule possibly overriding it?

spohlenz avatar May 26 '14 04:05 spohlenz

yes, i'm looking at the entries in the rails console right now. Not using any !important rules.

markmohr15 avatar May 26 '14 04:05 markmohr15

Can you please paste the HTML that is being output when rendering the page, as well as the HTML as it appears in the database?

spohlenz avatar May 26 '14 05:05 spohlenz

screen shot 2014-05-26 at 12 53 04 am screen shot 2014-05-26 at 12 53 36 am

markmohr15 avatar May 26 '14 05:05 markmohr15

Are you running the output through any other helpers such as simple_format? What is the code you are using to output the HTML?

spohlenz avatar May 26 '14 05:05 spohlenz

Here's the entire code of the page: screen shot 2014-05-26 at 10 13 25 am

markmohr15 avatar May 26 '14 15:05 markmohr15

Ok, wow, i'm an idiot. I don't even remember adding simple_format, but there it is.....Thanks spohlenz

markmohr15 avatar May 26 '14 15:05 markmohr15

@dinakaran Does this also solve your issue?

spohlenz avatar May 27 '14 11:05 spohlenz