ueditor使用问题

ueditor是一款强大的开源富文本编辑器,以下是使用中遇到的问题汇总,以后不断更新:(版本号为1.2.6.1)

1.图片上传问题

2.过滤标签问题

想要过滤a标签等样式,网上查了一下,设置blackList黑名单什么的方法都不行,根本没有这个选项。后来在ueditor的github论坛找到了一个样例,需要修改ueditor.config.js中的filterRules,就是最后注释的那个属性。具体内容可以参考这个Demo页面:http://ueditor.baidu.com/website/examples/filterRuleDemo.html
ps:这个问题调了好久,照着Demo添加了过滤函数还是不行,后来发现原因是自己用了ueditor.render()函数来生成编辑器,去掉这句就行了......

3.粘贴表格问题

粘贴表格时没反应,一开始以为是过滤器没弄好,看了ueditor.config.js文件中的filterRules函数,有对table及相关标签做处理,是没问题的。调试时控制台报了一个ueditor.all.min.js错误:
Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element': The 1st argument provided is either null, or an invalid Attr object. 

这也没法看啊,于是就把ueditor.all.min.js换成了ueditor.all.js。定位到1897行:
!browser.ie && node.removeAttributeNode(node.getAttributeNode('style')) 
呵呵,这下明白了,百度的程序员用了偷懒的写法,稍微改一下就行了:
if(!browser.ie && node.getAttributeNode('style')){
     node.removeAttributeNode(node.getAttributeNode('style'));
}




上一篇:阿里云服务器1核2GB5M配置仅需201元/年


下一篇:ARM服务器芯片难改AMD衰落命运