My app uses Rails 4, and I'm using the ckeditor gem and turbolinks.
In my form partial I call the ckeditor as so:
.form-group
= f.label :content, "Содержание", class: "col-sm-3 control-label"
.col-sm-8
= f.text_area :content, class: "form-control ckeditor", rows: 50
When I go to this page, I don't see ckeditor. Only after I update page does it appear. But why? What am I doing wrong? I think it's because of turbolinks. How do I solve this?
Using this gem: ckeditor
Gemfile for the last version
gem "ckeditor", :git => "https://github.com/galetahub/ckeditor.git"
Application.js
//= require ckeditor/init
In the views as the readme said:
<%= form_for @page do |form| -%>
...
<%= form.cktext_area :notes, :class => 'someclass', :ckeditor => {:language => 'uk'} %>
...
<%= form.cktext_area :content, :value => 'Default value', :id => 'sometext' %>
...
<%= cktext_area :page, :info, :cols => 40, :ckeditor => {:uiColor => '#AADC6E', :toolbar => 'mini'} %>
...
<% end -%>
Use cktext_area instead of text_area
for the rails 4 assets you need
//= require ckeditor/override
//= require ckeditor/init
And there's a trick for the compilation of assets, you need to look into the readme.
Hope it helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.