kindeditor html代码过滤 首发

官方
3. 为什么会丢失某些HTML标签,是不是编辑器的BUG?
这是因为3.4版本以前编辑器默认开启了过滤模式(filterMode:true)。当filterMode为true时,编辑器会根据htmlTags设定自动过滤HTML代码,主要是为了生成干净的代码。
如果想保留所有HTML,请将filterMode设置成false。如果想保留特定HTML,请将filterMode设置成true后,配置htmlTags属性。
从3.4版本开始默认关闭过滤模式,所以要过滤HTML,需要将filterMode设置成true。 KE . show ({
        id 
:   'textarea_id' ,
        filterMode 
:   true   // true:开启过滤模式, false:关闭过滤模式
});




我想去掉a标签 所以直接在kindeditor-min.js 中 搜索htmlTags 把默认的标签全部删除,哈哈 成功了。

官方的默认的

htmlTags

指定要保留的HTML标记和属性。哈希数组的key为HTML标签名,value为HTML属性数组,"."开始的属性表示style属性。
数据类型:Object
默认值:{
        font 
: ['color', 'size', 'face', '.background-color'],
        span 
: ['style'],
        div 
: ['class', 'align', 'style'],
        table
: ['class', 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'style'],
        
'td,th': ['class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor', 'style'],
        a 
: ['class', 'href', 'target', 'name', 'style'],
        embed 
: ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality',
        
'style', 'align', 'allowscriptaccess', '/'],
        img 
: ['src', 'width', 'height', 'border', 'alt', 'title', 'align', 'style', '/'],
        hr 
: ['class', '/'],
        br 
: ['/'],
        
'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : ['align', 'style'],
        
'tbody,tr,strong,b,sub,sup,em,i,u,strike' : []
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值