easyui有没有html编辑器,easyui编辑器(kindeditor-4.1.10)(示例代码)

0f1f90112ffe8e8f431dbab217f98bf2.png

//1  重写kindedit    -建一个js文件 easyui_kindeditor.js

(function ($, K) {

if (!K)

throw "KindEditor没有定义!";

function create(target) {

var opts = $.data(target, ‘kindeditor‘).options;

var editor = K.create(target, opts);

$.data(target, ‘kindeditor‘).options.editor = editor;

}

$.fn.kindeditor = function (options, param) {

if (typeof options == ‘string‘) {

var method = $.fn.kindeditor.methods[options];

if (method) {

return method(this, param);

}

}

options = options || {};

return this.each(function () {

var state = $.data(this, ‘kindeditor‘);

if (state) {

$.extend(state.options, options);

} else {

state = $.data(this, ‘kindeditor‘, {

options : $.extend({}, $.fn.kindeditor.defaults, $.fn.kindeditor.parseOptions(this), options)

});

}

create(this);

});

};

$.fn.kindeditor.parseOptions = function (target) {

return $.extend({}, $.parser.parseOptions(target, []));

};

$.fn.kindeditor.methods = {

editor : function (jq) {

return $.data(jq[0], ‘kindeditor‘).options.editor;

}

};

$.fn.kindeditor.defaults = {

resizeType : 1,

allowPreviewEmoticons : false,

allowImageUpload : false,

uploadJson : ‘${ctx}/wxMessage/uploadImg.yhtml‘,

fileManagerJson : ‘${ctx}/wxMessage/uploadImg.yhtml‘,

items : [

‘fontname‘, ‘fontsize‘, ‘|‘, ‘textcolor‘, ‘bgcolor‘, ‘bold‘, ‘italic‘, ‘underline‘,

‘removeformat‘, ‘|‘, ‘justifyleft‘, ‘justifycenter‘, ‘justifyright‘, ‘insertorderedlist‘,

‘insertunorderedlist‘, ‘|‘, ‘emoticons‘, ‘image‘, ‘link‘,‘fullscreen‘,‘wordpaste‘,‘source‘],

afterChange:function(){

this.sync();//这个是必须的,假设你要覆盖afterChange事件的话,请记得最好把这句加上.

}

};

$.parser.plugins.push("kindeditor");

})(jQuery, KindEditor);

//2   在页面引入  必要的文件   ——kindeditor-4.1.10能够在官方上下载到

// 3   页面上用

//编辑器

var editor;

KindEditor.ready(function (K) {

editor = K.create(‘textarea[name="content"]‘, {

allowFileManager: true,

resizeType: 1,

allowPreviewEmoticons: false,

items: [

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

‘removeformat‘, ‘|‘, ‘justifyleft‘, ‘justifycenter‘, ‘justifyright‘, ‘insertorderedlist‘,

‘insertunorderedlist‘, ‘|‘, ‘emoticons‘, ‘image‘, ‘link‘]

});

});

// 4   dataGrid 改动时  赋值  编辑框仅仅能手动赋值    row-选中行的数据    content 编辑器id   填充内容row.content     KindEditor是我们上面重写kindedit是定义的名字

function editWxSendMessage(row){

$("#win").window(‘open‘);

$("#wxsendmessageInfoForm").form(‘clear‘);

$("#wxsendmessageInfoForm").form("load", row);

KindEditor.html(‘#content‘, row.content);

}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值