WYSIWYG编辑器 之 ckeditor

访问量: 1545

(本篇作废,不要安装 这个gem ,要使用  gem 'ckeditor',  见: http://siwei.me/blog/posts/ckeditor-gem)

ckeditor的用法极其简单: (refer to: )

1. gem 'ckeditor_rails'

2. Add to your app/assets/javascripts/application.js after //= require jquery_ujs to work with jQuery

//= require ckeditor-jquery

3Modify form field for CKEditor

Add ckeditor class to text area tag

<%= f.text_area :content, :class => 'ckeditor' %>

但是缺点是无法上传图片。

搜了一圈, ckeditor 有一个上传图片的插件,叫做 ckfinder, 但是需要收费,而且目前支持的只有: .php,  .jsp,  .net  。这完全不符合开元项目的风格啊。要我们手写其实也可以,但是 估计要先 理解所有  ckeditor的代码。。。所以。。。我们需要新的gem ! 

p.s. 其实也有解决方案的:

refer to: http://stackoverflow.com/questions/3647905/how-exactly-do-you-integrate-ckeditor-with-paperclip-so-it-can-upload-image-filehttp://stackoverflow.com/questions/21928348/rails-4-ckeditor-file-upload

以及一个 完整的gem: 

https://github.com/galetahub/ckeditor

以及:  http://stackoverflow.com/questions/18752766/rails-4-with-ckeditor

订阅/RSS Feed

Subscribe

分类/category