[英]Rails 4 and ckeditor
My app uses Rails 4, and I'm using the ckeditor gem and turbolinks. 我的应用程序使用Rails 4,而我使用的是ckeditor gem和turbolinks。
In my form partial I call the ckeditor as so: 在我的部分表格中,我这样称呼ckeditor:
.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. 当我转到此页面时,看不到ckeditor。 Only after I update page does it appear.
只有在我更新页面之后,它才会出现。 But why?
但为什么? What am I doing wrong?
我究竟做错了什么? I think it's because of turbolinks.
我认为是因为turbolinks。 How do I solve this?
我该如何解决?
Using this gem: ckeditor 使用此宝石: ckeditor
Gemfile for the last version 最新版本的Gemfile
gem "ckeditor", :git => "https://github.com/galetahub/ckeditor.git"
Application.js 的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 使用cktext_area而不是text_area
for the rails 4 assets you need 您需要的Rails 4资产
//= 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! 希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.