When using Uediter to edit the HTML code, Div,span and other tags will be inexplicably filtered out, and then surf the Internet to check the data, changed the configuration:
1: Find allowdivtranstop in ueiter.all.js
me.setopt ({ ' allowdivtranstop ':true, ' disabledtableintable ':true });
Change true to False
me.setopt ({ ' allowdivtranstop ':false, ' disabledtableintable ':true });
2: Find allowdivtranstop in ueditor.config.js
// default filter Rule related configuration item // , Disabledtableintable:true //Prohibit form nesting //, allowdivtranstop:true // The div tag that allows access to the editor automatically becomes the P tag //, and the color in the rgb2hex:true//default output data is automatically converted from RGB format to 16 binary format
change true to False
// default filter Rule related configuration item // , Disabledtableintable:true //Prohibit table nesting , Allowdivtranstop:false // the div tag that allows access to the editor automatically becomes the P tag // , the color in the rgb2hex:true//default output data is automatically converted from RGB format to 16 binary format
3 Find whitlist Whitelist in ueditor.config.js
Some places say directly add a div[] span[] similar to:
But the following are already configured with these two
So I added ' name ' to these two items according to my needs, ' id ' like. If you have another label, add it again.
4 found in ueiter.all.js me.addoutputrule ...
Take a look at the note and the code is as follows
//content processing from the editorMe.addoutputrule (function(root) {varVal; Root.traversal (function(node) {if(Node.type = = ' Element ') { /*if (Me.options.autoClearEmptyNode && dtd. $inline [Node.tagname] &&!dtd. $empty [Node.tagname] && (!node.attrs | | utils.isemptyobject (NODE.ATTRS))) {if (!node.firstchild ()) Node.parentnode. RemoveChild (node); else if (node.tagname = = ' span ' && (!node.attrs | | utils.isemptyobject (NODE.ATTRS))) {node . Parentnode.removechild (node, true)} return; }*/ Switch(node.tagname) { Case' Div ': if(val = node.getattr (' Cdata_tag ') ) {Node.tagname=Val; Node.appendchild (UE.uNode.createText (node.getattr (' Cdata_data '))); Node.setattr ({cdata_tag:', Cdata_data: ', ' _ue_custom_node_ ': '}); } Break; CaseA: if(val = node.getattr (' _href ') {node.setattr ({' href ': Utils.html (val),' _href ': ' }) } Break; Break; /*Case ' span ': val = node.getattr (' id '); if (Val &&/^_baidu_bookmark_/i.test (val)) {Node.parentNode.removeChild (node) } break;*/ Case' IMG ': if(val = node.getattr (' _src ') {node.setattr ({' src ': node.getattr (' _src ')), ' _src ': ' }) } } } }) });};
5 Find Entertag in ueiter.all.js : ' P ', instead: Entertag: ', this step
After the above changes, the div and span tags are basically not filtered, but sadly, the span tag is filtered when I test it.
Original code:
<Divclass= "Td-text fl"> <span><Pstyle= "margin-top:60px;">Initial</P></span>
</Div><Divclass= "Text-one fl"> <Divclass= "One-one"> <spanclass= "FL"><P>Hang Qualification</P></span> <spanclass= "FL"><P>1.2w/year</P></span> </Div> <Divclass= "One-Two"> <spanclass= "FL"><P>Hanging items</P></span> <spanclass= "FL"><P>1.3w/year</P></span> </Div>
</Div>
The code after being filtered:
<Divclass= "Td-text fl"> <Pstyle= "margin-top:60px;">Initial</P></Div><Divclass= "Text-one fl"> <Divclass= "One-one"> <spanclass= "FL"><P>Hang Qualification</P></span> <spanclass= "FL"><P>1.2w/year</P></span> </Div> <Divclass= "One-Two"> <spanclass= "FL"><P>Hanging items</P></span> <spanclass= "FL"><P>1.3w/year</P></span> </Div></Div>
span with class is not filtered, and no span is filtered ... What the hell, how could this be ...
Scratching half an hour later, the occasional glimpse, see ueiter.all.js There is a autoclearemptynode:true, holding a try attitude, I changed to false, and then a try, became, That's nothing. The span tag has not been filtered, I have tried several times, really is this problem ~ ~ Haha, problem solving ~ ~
[JS] Use Baidu Editor Uediter encountered some problems (SPAN,DIV, etc. are filtered)