博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Easyui 基于kindeditor的扩展
阅读量:7209 次
发布时间:2019-06-29

本文共 1739 字,大约阅读时间需要 5 分钟。

源码

/**

* Author : ____′↘夏悸
* Easyui KindEditor的简单扩展.
* 有了这个之后,你就可以像使用Easyui组件的方式使用KindEditor了
* 前提是你需要导入KindEditor的核心js和相关样式. 本插件也需要在Easyui.min和KindEditor之后导入.
* 呵呵..没做深入扩展了,简单实现了一下功能,架子已经搭好.有需要的筒子可以在这基础上扩展.
**/
(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,
items : [
'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
'insertunorderedlist', '|', 'emoticons', 'image', 'link'],
afterChange:function(){
this.sync();//这个是必须的,如果你要覆盖afterChange事件的话,请记得最好把这句加上.
}
};
$.parser.plugins.push("kindeditor");
})(jQuery, KindEditor);

 

html

<textarea class="easyui-kindeditor" style="width:100%;height:200px;visibility:hidden;">KindEditor</textarea>

转载地址:http://ggoum.baihongyu.com/

你可能感兴趣的文章
Java Machine Learning Tools & Libraries--转载
查看>>
BZOJ 1199: [HNOI2005]汤姆的游戏 计算几何暴力
查看>>
spring mvc 请求转发和重定向
查看>>
PID控制器(比例-积分-微分控制器)- II
查看>>
android.graphics包中的一些类的使用
查看>>
将Ojective-C代码移植转换为Swift代码
查看>>
C#控制台程序取得INSOYA视频区的视频的真实URL,视频标题,发布时间集合。
查看>>
从控制台读取password - C#
查看>>
高通公司 MSM8K GPT异常原因分析无法开机的问题
查看>>
Android 升级下载 它们的定义Updates 兼容版本
查看>>
webstorm 10.0.4 注册码
查看>>
跨平台开源通讯组件elastic communication
查看>>
js dom学习
查看>>
Project Euler 98:Anagramic squares 重排平方数
查看>>
懒与馋的平衡:餐饮O2O市场广阔,发展不易
查看>>
Ubuntu下安装中文输入法
查看>>
(原)使用vectot的.end()报错:iterators incompatible
查看>>
通用软部件(通用管理信息系统)的研究与生产
查看>>
MFC中模态对话框和非模态对话框的差别
查看>>
数据挖掘算法 1 ID3(python)
查看>>