KindEditor的使用入门(一)

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"]');
})

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值