ueditor根目录下的ueditor.config.js:
找到:pasteplain和filterTxtRules,
复制一份放在下面,然后修改为:
,pasteplain:true //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
// 纯文本粘贴模式下的过滤规则
,'filterTxtRules' : function(){
function transP(node){
node.tagName = '';
node.setStyle();
}
return {
//直接删除及其字节点内容
'-' : 'script style object iframe embed input select',
'p': '',
'br':{$:{}},
'div':'',
'li':'',
'img':'img',
'caption':transP,
'th':transP,
'tr':transP,
'h1':transP,'h2':transP,'h3':transP,'h4':transP,'h5':transP,'h6':transP,
'td':function(node){
//没有内容的td直接删掉
var txt = !!node.innerText();
if(txt){
node.parentNode.insertAfter(UE.uNode.createText(' '),node);
}
node.parentNode.removeChild(node,node.innerText())
}
}
}()