问题
步骤:复制淘宝的图文详情,直接黏贴到百度富文本编辑器
现象:只能复制文字,图片相关内容为空,查看 html
代码,复制的内容不包含 img
标签
解决方案
1.找到ueditor.config.js
文件,搜索catchRemoteImageEnable
字段,设置为false
//设置远程图片是否抓取到本地保存
catchRemoteImageEnable: false, //设置是否抓取远程图片
2.同样是ueditor.config.js
文件,搜索pasteplain
和filterTxtRules
字段,注释这两个字段
// pasteplain:true, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
//纯文本粘贴模式下的过滤规则
// 'filterTxtRules' : function(){
// function transP(node){
// node.tagName = 'p';
// node.setStyle();
// }
// return {
// //直接删除及其字节点内容
// '-' : 'script style object iframe embed input select',
// 'p': {$:{}},
// 'br':{$:{}},
// 'div':{'$':{}},
// 'li':{'$':{}},
// /*'caption':transP,
// 'th':transP,
// 'tr':transP,
// 'h1':transP,'h2':transP,'h3':transP,'h4':transP,'h5':transP,'h6':transP,*/
// 'caption': {$:{}},
// 'th':{$:{}},
// 'tr':{$:{}},
// 'h1':{$:{}},'h2':{$:{}},'h3':{$:{}},'h4':{$:{}},'h5':{$:{}},'h6':{$:{}},
// 'td':function(node){
// //没有内容的td直接删掉
// var txt = !!node.innerText();
// if(txt){
// node.parentNode.insertAfter(UE.uNode.createText(' '),node);
// }
// node.parentNode.removeChild(node,node.innerText())
// }
// }
// }(),