//参考 https://blog.csdn.net/myweishanli/article/details/25800185
initKindEditer : function() {
KindEditor.ready(function(K) {
var editor = K.create('#detail', {
cssPath : '',
uploadJson : '/common/uploadImgAjax',
fileManagerJson : '',
allowFileManager : true,
filterMode : false,// 控制kindeditor编辑器不过滤任何标签
items : [ 'source', '|', 'undo', 'redo', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste',
'table', '|', 'formatblock', 'justifyleft', 'justifycenter', 'justifyright', 'lineheight',
'|', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', '|',
'selectall', '-', 'title', 'fontname', 'fontsize', 'forecolor', 'hilitecolor', '|',
'textcolor', 'bgcolor', 'bold', 'italic', 'underline', 'strikethrough', 'removeformat',
'|', 'image', 'hr', 'emoticons', 'link', 'unlink' ],
afterCreate : function() {
this.sync();
},
afterBlur : function() {
this.sync();
},
//限制字数 30字以内
afterChange : function() {
//$('.word_count1').html(this.count()); //字数统计包含HTML代码
//$('.word_count2').html(this.count('text'));//字数统计包含纯文本、IMG、EMBED,不包含换行符,IMG和EMBED算一个文字
if(this.count('text') > 30) {
var strValue=editor.text();
editor.text("");
editor.appendHtml(strValue.substring(0,30));
}
}
});
editor.sync();
});
},