Closed zhangcaiyan closed 10 years ago
KE本身不存在,你试一下Kindeditor
,或者给创建的editor指定editor_id
再试试
这个应该去看看Kindeditor的官方文档吧,或者去下面提交一个issue
朋友,昨天我看了官方文档,在结合你的插件,这样是可以实现,不明白为啥,无法直接制定simple样式,后来看了你的源代码里,也是通过item来实现的。我觉得应该有更好的实现方式,我去看看啊,谢谢了 KindEditor.ready(function(K) { contact = K.create('#job_contact', { items: ["fontname","fontsize", "|", "forecolor", "hilitecolor", "bold", "italic", "underline", "removeformat", "|", "justifyleft", "justifycenter", "justifyright", "insertorderedlist", "insertunorderedlist", "|", "emoticons", "image", "link"], afterChange: function(){ content_length = contact.text().length $("#contact_notice span").text(1000-content_length) } }); });
这种方式有一个很糟糕的地方是 上传图片等都出现问题了,还得手动指定
还有朋友,我还有两个问题:
1:我设置uploadJson的path中的owner_id为nil,这个会不会有什么影响啊,谢谢了 uploadJson: "<%= kindeditor_upload_json_path(owner_id: nil) %>"
2: 我直接通过html().length获取到的长度,保存后,在console下我查看并不一样,这个是怎么回事啊,谢谢了
朋友,我用以下方式解决了这个问题:
KindEditor.ready(function(K) {
content = K.create('#content', {
items: items,
allowFileManager: true,
fileManagerJson: "<%= kindeditor_file_manager_json_path %>",
uploadJson: "<%= kindeditor_upload_json_path(owner_id: nil) %>",
afterChange: function(){
........
}
})
})
这里有个疑问: uploadJson 指定为 "<%= kindeditor_upload_json_path(owner_id: nil) %>",owner_id 为nil会产生什么影响啊,这个有关系吗,谢谢了
在 2014年3月6日 上午12:01,Macrow notifications@github.com写道:
KE本身不存在,你试一下Kindeditor,或者给创建的editor指定editor_id再试试
这个应该去看看Kindeditor的官方文档吧,或者去下面提交一个issue
https://github.com/kindsoft/kindeditor
— Reply to this email directly or view it on GitHubhttps://github.com/Macrow/rails_kindeditor/issues/60#issuecomment-36757618 .
owner_id主要用于设置关联,如果不使用关联,设置成nil没有任何影响。
关于获取kindeditor文本长度,建议看看官方文档
我在 http://kindeditor.net/docs/editor.html#count-mode 看到有一个API,
即 count,你看看这个函数是否能正确返回你需要的数据。
我看了很多kindeditor相关资料,一直没有搞定这个。如下:
KE.event.add(el, event, listener)
KE本身就不存在