KindEditor 使用 JavaScript 编写,可以无缝的与 Java、.NET、PHP、ASP 等程序接合。本文给大家介绍 Kindeditor 在线文本编辑器如何过滤 html,需要的朋友参考下吧
KindEditor 是一套开源的 HTML 可视化编辑器,主要用于让用户在网站上获得所见即所得编辑效果,兼容 IE、Firefox、Chrome、Safari、Opera 等主流浏览器。KindEditor 使用 JavaScript 编写,可以无缝的于 Java、.NET、PHP、ASP 等程序接合。
KindEditor 是一套开源的 HTML 可视化编辑器,主要用于让用户在网站上获得所见即所得编辑效果,兼容 IE、Firefox、Chrome、Safari、Opera 等主流浏览器。 KindEditor 使用 JavaScript 编写,可以无缝的与 Java、.NET、PHP、ASP 等程序接合。这个是官网上的介绍。
主页:{aa2aa}
下载:{aa1aa}
示例:{aa0aa}
过滤方法也简单:
- KindEditor.ready(function(K) {
- editor = K.create('textarea[name="content"]', {
- filterMode: true,
- //是否开启过滤模式
- });
- });
- KindEditor.ready(function (K) {
- editor = K.create('textarea[name="content"]', {
- filterMode: true,//是否开启过滤模式
- htmlTags : {
- font : ['id', 'class', 'color', 'size', 'face', '.background-color'],
- div : [
- 'id', 'class', 'align', '.border', '.margin', '.padding', '.text-align', '.color',
- '.background-color', '.font-size', '.font-family', '.font-weight', '.background',
- '.font-style', '.text-decoration', '.vertical-align', '.margin-left'
- ],
- a : ['id', 'class', 'href', 'target', 'name'],
- embed : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
- img : ['id', 'class', 'src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'],
- 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
- 'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background',
- '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left'
- ],
- pre : ['id', 'class'],
- hr : ['id', 'class', '.page-break-after'],
- 'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : ['id', 'class'],
- iframe : ['id', 'class', 'src', 'frameborder', 'width', 'height', '.width', '.height']
- }
- });
- });
来源: http://www.phperz.com/article/17/0219/266327.html