2023-08-04 10:15AM
gem 'ckeditor'
gem 'paperclip'
$ bundle install
$ rails generate ckeditor:install --orm=active_record --backend=paperclip
在config/initializers/assets.rb
:
Rails.application.config.assets.precompile += %w[ckeditor/config.js]
config/
application.rb
config.autoload_paths += %w(#{config.root}/app/models/ckeditor)
mount Ckeditor::Engine => '/ckeditor'
Ckeditor.setup do |config|
# //cdn.ckeditor.com/<version.number>/<distribution>/ckeditor.js
#增加下面这一行
config.cdn_url = "//cdn.ckeditor.com/4.6.1/basic/ckeditor.js"
end
javascript_include_tag Ckeditor.cdn_url
<script src="//cdn.ckeditor.com/4.19.0/standard/ckeditor.js"></script>
<script src="//cdn.ckeditor.com/4.19.0/basic/ckeditor.js"></script>
<script src="//cdn.ckeditor.com/4.19.0/full/ckeditor.js"></script>
<%= f.cktext_area :content %>
做完上面几步, 再去浏览器刷新页面,ckeditor应该就差不多了。
登录
请登录后再发表评论。
评论列表:
目前还没有人发表评论