首先下载
- ruby script/plugin install svn://rubyforge.org/var/svn/fckeditorp/trunk/fckeditor
其他说明:
(1)FCKeditor安装在项目根目录下的vendor/plugins/fckeditor 里,
(2)README文件代有使用说明
在你要使用是视图上添上
- <%= javascript_include_tag :fckeditor %>
或
- <%= javascript_include_tag "fckeditor/fckeditor" %>
在需要富文本的Form表单用如下语句生成一个富文件编辑框:
- <%= fckeditor_textarea("object", "field", :toolbarSet => 'Simple', :width => '100%', :height => '200px') %>
说明:object对应模型对象,field对应它的字段。
如果是用了ajax,则需要在form_remote_tag加上一个before项
- <%= form_remote_tag(:update => update,
- :before => fckeditor_before_js('topic', 'content'),
- :url => {:controller => 'topics', :action => 'create', :template => 'show'} )%>
并且富文件编辑框要加一个ajax=true的选项:
- <%= fckeditor_textarea(:topic, :content, :ajax => true, :toolbarKit => 'Simple', :width => '100%', :height => '600px') %>