kind富文本编辑器_kindEditor富文本编辑器

[

'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',

'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',

'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',

'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',

'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',

'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',

'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',

'anchor', 'link', 'unlink', '|', 'about'

]

二、常见问题

2.kindeditor异步渲染dom才出现富文本,ready失效

解析:

KindEditor.ready(function(K)) {

K.create('#editor_id');

}

他自己提供的ready方法一般情况下都不会有问题。

首先,kindeditor.ready()方法想要在dom加载完成后创建富文本框,调用的是dom load.但并不支持异步。

问题1,使用requirejs引入的,在执行KindEditor.ready代码的时候dom结构早就完成了,动态插入的script代码不会再次触发DOMContentLoaded事件,因此KindEditor.ready注册的回调永远不会被执行,富文本框当然不会出现啦。解决方案很简单,不要使用KinkEditor.ready,直接KindEditor.create(...就好啦。

问题2,富文本编辑应是在异步请求之后渲染的,

三 、常用方法

afterfocus,self.editor.text(),self.editor.html()

KindEditor.ready(function(K) {

self.editor = K.create('textarea[name="intro"]', {

resizeType : 1,

items : [

'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',

'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',

'insertunorderedlist'

],

afterfocus: function(){

},

afterCreate: function(){this.sync();},

afterBlur : function(){

this.sync();

self.isEditorEmpty();

}

});

});

isEditorEmpty: function(){

var self = this;

var _intro = self.editor.text();//获取编辑器内容

if(!$.trim(_intro)){

$('.intro-error').text('请输入公司简介');

return false;

}else{

$('.intro-error').text('');

return true;

}

},

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值