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"]'); })
相关文章推荐
- C++数组
- 【菜鸟要学习】string 用法详解
- POJ-3278 Catch That Cow
- POJ C程序设计进阶 编程题#2:角谷猜想
- unity, UGUI Text outline
- 关于网站sql注入解决方案
- Linux中mysql表的导出导入
- 深入理解 Session 与 Cookie
- 安卓界面跳转时取消系统自带的动画
- Java中Cloneable 和 clone()的总结和使用
- android技巧:把自己的app变成手机系统自带的app[/system/app]
- Zeppelin
- POJ C程序设计进阶 编程题#1:单词翻转
- Math.ceil(a/b)结果出错--原因是a和b不是double
- DRBD 环境,产生脑裂解决办法
- 文件复制软件评测:FastCopy、TeraCopy、ExtremeCopy、Supercopier
- mac 下面破解MyEclipse 10的方法
- Hiking(vector+优先队列 实现贪心)
- 最近两月的生活
- [LeetCode] Binary Tree Zigzag Level Order Traversal