这个时候,首先,需要给图片自动上传加上属性,不如对于jquery.lazyload延迟加载的图片,必定带有data-original属性,只要检测出此属性,就不远程上传。其它属性自定义提那家,代码如下:
‘wordimage‘:{
???????????execCommand:function () { ???????????????var images = domUtils.getElementsByTagName(me.body, "img"); ???????????????var urlList = []; ???????????????for (var i = 0, ci; ci = images[i++];) { ???????????????????if(ci.getAttribute("data-original")||ci.getAttribute("original")||ci.getAttribute("local")||ci.getAttribute("remote")||ci.getAttribute("qiniu")){ ???????????????????????break; ???????????????????}else { ???????????????????????var url = ci.getAttribute("word_img"); ???????????????????????url && urlList.push(url); ???????????????????} ???????????????} ???????????????return urlList; ???????????},
第二,去除,对于script的过滤,对于script标签,添加特定的id活着class,不让ueditor处理。
???????????????case ‘style‘: ???????????????case ‘script‘: ???????????????????if(node.id===‘andyZhou‘||node.className==="andyZhou"){ ???????????????????????break; ???????????????????}else { ???????????????????????node.setAttr({ ???????????????????????????cdata_tag: node.tagName, ???????????????????????????cdata_data: (node.innerHTML() || ‘‘), ???????????????????????????‘_ue_custom_node_‘:‘true‘ ???????????????????????}); ???????????????????????node.tagName = ‘div‘; ???????????????????????node.innerHTML(‘‘); ???????????????????????break; ???????????????????} ???????????????????break;
第三,在白名单中添加script和style标签。
???????script:[‘src‘,‘defer‘,‘async‘,‘charset‘], ???????source:[‘src‘], ???????style:[],
这个时候,你就可以在html模式下自定义编辑,又享受ueditor的好处。
这个是自己DIY随便琢磨的,如果有更好的模式,请指教,多些。
转载请注明出处:ueditor样式过滤去除和远程图片上传自定义 - phpcms教程 - 周陆军的个人网站请添加链接描述
ueditor样式过滤去除和远程图片上传自定义
原文地址:http://blog.51cto.com/zhoulujun/2087525