spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
816 stars 258 forks source link

Cannot update styles on rails 4 #136

Open dinakaran opened 10 years ago

dinakaran commented 10 years ago

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

spohlenz commented 10 years ago

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

dinakaran commented 10 years ago

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

markmohr15 commented 10 years ago

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.

spohlenz commented 10 years ago

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 %>
markmohr15 commented 10 years ago

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

spohlenz commented 10 years ago

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

markmohr15 commented 10 years ago

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

spohlenz commented 10 years ago

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?

markmohr15 commented 10 years ago

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

spohlenz commented 10 years ago

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

markmohr15 commented 10 years ago

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

markmohr15 commented 10 years ago

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

spohlenz commented 10 years ago

@dinakaran Does this also solve your issue?