Rails3中施用Kindeditor

Rails3中使用Kindeditor

        现在富文本编辑器挺多的,有轻巧型的,也有功能强大型的。如果你发现CKEditor、TinyMCE不是你想要的,你可以考虑一下Kindeditor 这个漂亮的Editor,在Rails中配合插件使用,还是比较简单的。


安装和使用:

 

    doabit做了一个gem在https://github.com/doabit/kindeditor ,按照它的README来做就可以了。

 

其他:

    如果你需要一个页面中显示两个Kindeditor的话,可以这样:

KE.show({
    id : 'info_summary',
    allowFileManager : true,
    imageUploadJson:'/kindeditor/upload'
});
KE.show({
    id : 'info_content',
    allowFileManager : true,
    imageUploadJson:'/kindeditor/upload'
});

 

        如果你在IE中上传图片的时候,出现“服务器发生故障” ,可能是由于ContentType造成的。解决办法是,在Model KindeditorImage的validates_attachment_content_type :data, :content_type中增加 'image/x-png' 'image/pjpeg' 。具体原因,参考下列文章:

 

http://www.cnblogs.com/liszt/archive/2010/12/31/1923134.html

http://ask.wangmeng.cn/question/76