当前位置:首页 > kindeditor
默认值:../../php/upload_json.php 注: 3.4.1版本开始支持。 26.
fileManagerJson
指定浏览远程图片的服务器端程序。 数据类型:String
默认值:../../php/file_manager_json.php 注: 3.4.1版本开始支持。 27.
autoSetDataMode
true或false,true时自动将编辑器内容设置到原来的textarea,也就是每次输入内容就执行KE.util.setData函数。 数据类型:Boolean 默认值:true
注: 3.5版本开始支持。打开autoSetDataMode模式后会降低输入性能,理想的做法是关闭autoSetDataMode,提交数据前执行KE.util.setData。 28.
afterSetData
自动执行KE.util.setData后执行的回调函数,autoSetDataMode为true时有效。 数据类型:Function 默认值:无
注: 3.5版本开始支持。 29.
shadowMode
true或false,true时弹出层显示阴影。 数据类型:Boolean 默认值:true
注: 3.5版本开始支持。 30.
allowPreviewEmoticons
true或false,true时鼠标放在表情上可以预览表情。 数据类型:Boolean 默认值:true
注: 3.5版本开始支持。 参数设置例子:
KE.show({
id : \,
width : \, //编辑器的宽度为70% height : \, //编辑器的高度为100px filterMode : false, //不会过滤HTML代码 resizeMode : 1 //编辑器只能调整高度 });
一、添加\你好\插件 1.
定义KE.lang['hello'] = \你好\。
KE.lang['hello'] = \您好\;
2.
定义KE.plugin['hello'],所有逻辑都在这个对象里,点击图标时默认执行click方法。
KE.plugin['hello'] = { click : function(id) { alert(\您好\); } };
3.
页面里添加图标定义CSS。
.ke-icon-hello {
background-image: url(./skins/default.gif); background-position: 0px -672px; width: 16px; height: 16px; }
4.
最后调用编辑器时items数组里添加hello。
KE.show({
id : 'content1', items : ['hello'] });
演示地址:在新窗口打开 二、添加插入远程图片的插件 1.
定义KE.lang['remote_image'] = \插入远程图片\。
KE.lang['remote_image'] = \插入远程图片\;
2.
定义KE.plugin['remote_image']。
KE.plugin['remote_image'] = { click : function(id) { KE.util.selection(id); var dialog = new KE.dialog({ id : id,
cmd : 'remote_image', width : 310, height : 90,
title : KE.lang['image'], yesButton : KE.lang['yes'], noButton : KE.lang['no'] });
dialog.show(); },
check : function(id) {
var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog); var url = KE.$('url', dialogDoc).value; var title = KE.$('imgTitle', dialogDoc).value; var width = KE.$('imgWidth', dialogDoc).value; var height = KE.$('imgHeight', dialogDoc).value; var border = KE.$('imgBorder', dialogDoc).value; if (url.match(/\\.(jpg|jpeg|gif|bmp|png)$/i) == null) { alert(KE.lang['invalidImg']); window.focus();
KE.g[id].yesButton.focus(); return false; }
if (width.match(/^\\d+$/) == null) { alert(KE.lang['invalidWidth']); window.focus();
KE.g[id].yesButton.focus(); return false; }
if (height.match(/^\\d+$/) == null) { alert(KE.lang['invalidHeight']); window.focus();
KE.g[id].yesButton.focus(); return false; }
if (border.match(/^\\d+$/) == null) { alert(KE.lang['invalidBorder']); window.focus();
KE.g[id].yesButton.focus(); return false; }
return true; },
exec : function(id) { KE.util.select(id);
var iframeDoc = KE.g[id].iframeDoc;
var dialogDoc = KE.util.getIframeDoc(KE.g[id].dialog); if (!this.check(id)) return false; var url = KE.$('url', dialogDoc).value; var title = KE.$('imgTitle', dialogDoc).value; var width = KE.$('imgWidth', dialogDoc).value; var height = KE.$('imgHeight', dialogDoc).value; var border = KE.$('imgBorder', dialogDoc).value; this.insert(id, url, title, width, height, border); },
insert : function(id, url, title, width, height, border) { var html = '
if (width > 0) html += 'width=\ + width + '\; if (height > 0) html += 'height=\ + height + '\; if (title) html += 'title=\ + title + '\; html += 'alt=\ + title + '\; html += 'border=\ + border + '\; KE.util.insertHtml(id, html); KE.layout.hide(id); KE.util.focus(id); } };
3.
页面里添加图标定义CSS。
.ke-icon-remote_image {
background-image: url(./skins/default.gif); background-position: 0px -496px; width: 16px; height: 16px; }
4.
最后调用编辑器时items数组里添加remote_image。
KE.show({
id : 'content1',
items : ['remote_image'] });
演示地址:在新窗口打开 一、变量
共分享92篇相关文档