Reputation: 4427
So I installed this implementation of tinymce-rails gem:
gem 'tinymce-rails'
to the Gemfile and ran bundle install
//= require tinymce-jquery
in app/assets/javascripts/application.js
.bundle exec rake assets:precompile
for productionadded this to my form:
<%= f.label :body %>
<%= f.text_area :body, :class => "mceEditor" %>
All works wonderfully! It's an awesome editor.
But, I don't want to liter that script code throughout my forms. Probably a dumb question. But where is the place to put this script code so it is globally (and automaticlally) going to be used on an text areas that are class "mceEditor".
Thanks!
Upvotes: 0
Views: 1335
Reputation: 113
I followed another post to get it set up. I don't remember where I read it from..so apologies for not giving due credit to the original author. This is how i have it. I think its much cleaner and not have to sprinkle the javascript throughout.
add <%= tinymce_assets %> <%= tinymce %> where you want it to be initialized to initialise it. For instance this is I have in a form partial
"tinymce", :size => "100 x50" %>
This is what I have in my tinymce.yml file
theme_advanced_toolbar_location: top
theme_advanced_toolbar_align: left
theme_advanced_statusbar_location: bottom
theme_advanced_buttons1 :
- bold
- italic
- underline
theme_advanced_buttons2 :
theme_advanced_buttons3 :
plugins :
- preview
- autolink
Upvotes: 0