您的位置:首页 > 其它

KindEditor的使用入门(一)

2015-08-07 13:11 417 查看
KindEditor.options.filterMode = true;
KindEditor.ready(function (K) {
editore1 = K.create('textarea[name="contente_01"]', {
cssPath: root + '/assets/global/plugins/kindeditor/plugins/code/prettify.css',
uploadJson: root + '/pics;jsessionid=' + $("#token_str2").val(),
allowFileManager: true,
wellFormatMode: true,
allowFlashUpload: true,
resizeType: 0,
afterCreate: function () {
this.sync();
}
});
});
页面
<textarea id="editor_ide1" name="contente_01"
style="width:800px;height:300px;">
</textarea>
直接在ajax里面赋值
editore1.html(data[0]);
你们自己可以扩展其他内容,这里注意3点:1点:
cssPath: root + '/assets/global/plugins/kindeditor/plugins/code/prettify.css',
这个我页面的加上去了没有用,还要这里加一个才ok;我也不知道,搜索参考的
2点:
<input type="hidden" id="token_str2" name="token_str2" value="${token_str}"
uploadJson: root + '/pics;jsessionid=' + $("#token_str2").val(),
跳转页面时候
String token_str = request.getSession().getId();
model.addAttribute("token_str", token_str);
批量图片上传关键这里的session,这是固定写法;ok;我也不知道,搜索参考的
3点:
afterCreate: function () {
this.sync();
}
这里是将KindEditor富文本内容给textarea文本域,你后台获取的是
textarea的内容而不是KindEditor富文本内容
要不然你获取的就是空“”,
注意:我的是bootstrap模版上model上使用富文本,文本框失效,这个我不知道怎么去掉富文本的屏蔽,
有人说可以在model层弹出来后再加载富文本,关闭model层后又移除富文本,脑袋大啊,不知道怎么搞。
以下是搜索到的别人写的,我无法移植:
//显示modal $('#myModal').modal('show'); //show完毕前执行 $('#myModal').on('shown', function () { //加上下面这句!解决了~ $(document).off('focusin.modal'); // 打开Dialog后创建编辑器 KindEditor.create('textarea[name="content"]', {
resizeType : 1 });
}) //hide完毕前执行 $('#myModal').on('hidden', function () { // 关闭Dialog前移除编辑器 KindEditor.remove('textarea[name="content"]');
})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: