在线HTML编辑器KindEditor
简介
KindEditor是一套开源的HTML可视化编辑器,主要用于让用户在网站上获得所见即所得编辑效果,兼容IE、Firefox、Chrome、Safari、Opera等主流浏览器。KindEditor使用JavaScript编写,可以无缝的于Java、.NET、PHP、ASP等程序接合。
示例
$(function() {
KindEditor.ready(function(K) {
editor1 = K.create('textarea[name="menuContent"]', {
allowFileManager : true,//true时显示浏览远程服务器按钮
allowPreviewEmoticons : false,
wellFormatMode:false,
wellFormatMode:false,
width:,
height:,
allowImageUpload : true,
items:["source", "preview","template","cut","copy","paste",
"plainpaste","wordpaste","justifyleft","justifycenter",
"justifyright","justifyfull","insertorderedlist","insertunorderedlist",
"indent","outdent","subscript","superscript","quickformat",
"formatblock","fontname","fontsize","forecolor","hilitecolor",
"bold","italic","underline","strikethrough","lineheight","removeformat",
"table","hr","link","unlink","image","fontsize"],
afterCreate : function() {
},afterBlur: function(){
this.sync();
}
});
});
参数说明
width
编辑器的宽度,可以设置px或%,比textarea输入框样式表宽度优先度高。
- 数据类型: String
- 默认值: textarea输入框的宽度
height
编辑器的高度,只能设置px,比textarea输入框样式表高度优先度高。
- 数据类型: String
- 默认值: textarea输入框的高度
minWidth
指定编辑器最小宽度,单位为px。
- 数据类型: Int
- 默认值: 650
minHeight
指定编辑器最小高度,单位为px。
- 数据类型: Int
- 默认值: 100
items
配置编辑器的工具栏,其中”/”表示换行,”|”表示分隔符。
- 数据类型: Array
- 默认值:
[
'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'
]
| source | HTML代码 |
| preview | 预览 |
| undo | 后退 |
| redo | 前进 |
| cut | 剪切 |
| copy | 复制 |
| paste | 粘贴 |
| plainpaste | 粘贴为无格式文本 |
| wordpaste | 从Word粘贴 |
| selectall | 全选 |
| justifyleft | 左对齐 |
| justifycenter | 居中 |
| justifyright | 右对齐 |
| justifyfull | 两端对齐 |
| insertorderedlist | 编号 |
| insertunorderedlist | 项目符号 |
| indent | 增加缩进 |
| outdent | 减少缩进 |
| subscript | 下标 |
| superscript | 上标 |
| formatblock | 段落 |
| fontname | 字体 |
| fontsize | 文字大小 |
| forecolor | 文字颜色 |
| hilitecolor | 文字背景 |
| bold | 粗体 |
| italic | 斜体 |
| underline | 下划线 |
| strikethrough | 删除线 |
| removeformat | 删除格式 |
| image | 图片 |
| flash | Flash |
| media | 视音频 |
| table | 表格 |
| hr | 插入横线 |
| emoticons | 插入表情 |
| link | 超级链接 |
| unlink | 取消超级链接 |
| fullscreen | 全屏显示 |
| about | 关于 |
| 打印 | |
| code | 插入程序代码 |
| map | Google地图 |
| baidumap | 百度地图 |
| lineheight | 行距 |
| clearhtml | 清理HTML代码 |
| pagebreak | 插入分页符 |
| quickformat | 一键排版 |
| insertfile | 插入文件 |
| template | 插入模板 |
| anchor | 插入锚点 |
noDisableItems
designMode 为false时,要保留的工具栏图标。
- 数据类型: Array
- 默认值: [‘source’, ‘fullscreen’]
filterMode
true时根据 htmlTags 过滤HTML代码,false时允许输入任何代码。
- 数据类型: Boolean
- 默认值: true
Note
4.1.1版本开始默认值为true。
htmlTags
指定要保留的HTML标记和属性。Object的key为HTML标签名,value为HTML属性数组,”.”开始的属性表示style属性。
- 数据类型: Object
- 默认值:
{
font : ['color', 'size', 'face', '.background-color'],
span : [
'.color', '.background-color', '.font-size', '.font-family', '.background',
'.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.line-height'
],
div : [
'align', '.border', '.margin', '.padding', '.text-align', '.color',
'.background-color', '.font-size', '.font-family', '.font-weight', '.background',
'.font-style', '.text-decoration', '.vertical-align', '.margin-left'
],
table: [
'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'bordercolor',
'.padding', '.margin', '.border', 'bgcolor', '.text-align', '.color', '.background-color',
'.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.background',
'.width', '.height', '.border-collapse'
],
'td,th': [
'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor',
'.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight',
'.font-style', '.text-decoration', '.vertical-align', '.background', '.border'
],
a : ['href', 'target', 'name'],
embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
img : ['src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'],
'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background',
'.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left'
],
pre : ['class'],
hr : ['class', '.page-break-after'],
'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : []
}
wellFormatMode
true时美化HTML数据。
- 数据类型: Boolean
- 默认值: true
resizeType
2或1或0,2时可以拖动改变宽度和高度,1时只能改变高度,0时不能拖动。
- 数据类型: Int
- 默认值: 2
themeType
指定主题风格,可设置”default”、”simple”,指定simple时需要引入simple.css。
- 数据类型: String
- 默认值: “default”
示例:
<link rel="stylesheet" href="../themes/default/default.css" />
<link rel="stylesheet" href="../themes/simple/simple.css" />
<script charset="utf-8" src="../kindeditor.js"></script>
<script charset="utf-8" src="../lang/zh-CN.js"></script>
<script>
var editor;
KindEditor.ready(function(K) {
editor = K.create('#editor_id', {
themeType : 'simple'
});
});
</script>
langType
指定语言,可设置”en”、”zh-CN”,需要引入lang/[langType].js。
- 数据类型: String
- 默认值: “zh-CN”
示例:
<link rel="stylesheet" href="../themes/default/default.css" />
<script charset="utf-8" src="../kindeditor.js"></script>
<script charset="utf-8" src="../lang/en.js"></script>
<script>
var editor;
KindEditor.ready(function(K) {
editor = K.create('#editor_id', {
langType : 'en'
});
});
</script>
urlType
改变站内本地URL,可设置”“、”relative”、”absolute”、”domain”。空为不修改URL,relative为相对路径,absolute为绝对路径,domain为带域名的绝对路径。
- 数据类型: String
- 默认值: “”
colorTable
指定取色器里的颜色。
- 数据类型: Array
- 默认值:
[
['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'],
['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'],
['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'],
['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000']
]
afterUpload
上传文件后执行的回调函数。
- 数据类型: Function
- 默认值: 无
KindEditor.ready(function(K) {
K.create('#id', {
afterUpload : function(url) {
alert(url);
}
});
});
fontSizeTable
指定文字大小。
- 数据类型: Array
- 默认值:
['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px']
extraFileUploadParams
上传图片、Flash、视音频、文件时,支持添加别的参数一并传到服务器。
- 数据类型: Array
- 默认值: {}
KindEditor.ready(function(K) {
K.create('#id', {
extraFileUploadParams : {
item_id : 1000,
category_id : 1
}
});
});
Note
4.1.1版本开始支持。
fillDescAfterUploadImage
true时图片上传成功后切换到图片编辑标签,false时插入图片后关闭弹出框。
- 数据类型: Boolean
- 默认值: false
Note
4.1.2版本开始支持。
pagebreakHtml
可指定分页符HTML。
- 数据类型: String
- 默认值: <hr style=”page-break-after: always;” class=”ke-pagebreak” />
Note
4.1.3版本开始支持。
参考链接:http://kindeditor.net/docs/option.html
在线HTML编辑器KindEditor的更多相关文章
- 纯JS文本在线HTML编辑器KindEditor
KindEditor(http://www.kindsoft.net)是一款比较专业,主流,好用的在线HTML编辑器. 它除了可以将文本进行编辑.将Word中的内容复制进来外,本身还可以拖动缩放(右下 ...
- HTML编辑器KindEditor
KindEditor 是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果,开发人员可以用 KindEditor 把传统的多行文本输入框(textarea)替换为可视化的富文本 ...
- $Django 在线文本编辑器skindeditor
简介 KindEditor是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果,开发人员可以用 KindEditor 把传统的多行文本输入框(textarea)替换为可视化的富 ...
- HTML编辑器 -- KindEditor
KindEditor 是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果,开发人员可以用 KindEditor 把传统的多行文本输入框(textarea)替换为可视化的富文本 ...
- Django配置富文本编辑器kindeditor
一.简介 django是一个容易快速上手的web框架,用它来创建内容驱动型的网站(比如独立博客)十分方便.遗憾的是,django并没有提供官方的富文本编辑器,而后者恰好是内容型网站后台管理中不可或缺的 ...
- Django之富文本编辑器kindeditor 及上传
1.什么是富文本编辑器 百度百科(https://baike.baidu.com/item/%E5%AF%8C%E6%96%87%E6%9C%AC%E7%BC%96%E8%BE%91%E5%99%A8 ...
- 基于jquery的bootstrap在线文本编辑器插件Summernote
Summernote是一个基于jquery的bootstrap超级简单WYSIWYG在线编辑器.Summernote非常的轻量级,大小只有30KB,支持Safari,Chrome,Firefox.Op ...
- 富文本编辑器kindeditor配置
<!--富文本编辑器kindeditor配置↓ --> <link type="text/css" rel="stylesheet" href ...
- (视频) 《快速创建网站》 3.2 WordPress多站点及Azure在线代码编辑器 - 扔掉你的ftp工具吧,修改代码全部云端搞定
本文是<快速创建网站>系列的第6篇,如果你还没有看过之前的内容,建议你点击以下目录中的章节先阅读其他内容再回到本文. 访问本系列目录,请点击:http://devopshub.cn/tag ...
随机推荐
- 《温故而知新》JAVA基础四
类的封装 定义:将类的一些信息隐藏起来,不允许外部的程序直接的访问,而是通过该类提供的一些方法来获取 好处:只能通过特定的法方法访问数据,保护了数据, 实现封装的步骤: 修改属性的可见性:(一般类属性 ...
- sony Z5P 刷rec、root的方法
想root需要刷第三方recovery,刷recovery需要先解锁.但如果直接解锁,会丧失相机算法.屏幕超逼真模式,所以不能直接来. 大体步骤就是解完锁后自己做个内核刷进去,欺骗系统让他觉得没解锁. ...
- 本地构建:Gulp
Gulp中文网:https://www.gulpjs.com.cn/ Gulp英文网:https://gulpjs.com/ Gulp:工作流程自动化+强化 (一)安装初始化 (二)基础API及插件 ...
- spring aop 中的JoinPoint
AspectJ使用org.aspectj.lang.JoinPoint接口表示目标类连接点对象,如果是环绕增强时,使用org.aspectj.lang.ProceedingJoinPoint表示连接点 ...
- 一个完整的成年果蝇大脑的电子显微镜图谱 | A Complete Electron Microscopy Volume of the Brain of Adult Drosophila melanogaster
paper:A Complete Electron Microscopy Volume of the Brain of Adult Drosophila melanogaster 果蝇是一个非常完美的 ...
- CentOS安装vmtools后 共享文件不能显示的问题
摘要:以 下这些方法都是我转自网上的一些比较靠谱的方法,但是大多都是针对ununtu的,特别是针对共享文件挂载的相应处理方法.所以在这里,我主要是这对 centos不能显示共享文件的问题做了重点的介绍 ...
- DP爬台阶问题
1. 初级爬台阶 - 求最短步数 LC - 70 一次可以迈1-2个台阶,因此最短步数与前两个台阶有关. Initial state: 第一阶:1步 : 第二阶:1步 deduction functi ...
- python自动化测试入门篇-jemter
接口测试基础-jemter 接口文档地址:http://doc.nnzhp.cn 使用jmeter实现简单的http request的接口测试 一.get获取学生信息接口 第一步:新建一个Thread ...
- 第五周作业--测试与版本发布(Alpha版本)
github传送门:https://github.com/Bubblegod/StardrewValley 一.BUG以及修复 a.修复的BUG: 1.存在着运行环境改变后,资源找不到问题 BUG描述 ...
- springboot+thymeleaf+springbootJPA实现一个简单的增删改查
1.springboot是什么,给我们带来了什么方便? 通过阅读springboot的书籍发现springboot最便利的是为我们自动配置了很多的东西,几乎可以实现无xml,甚至简单的无sql,为我们 ...