roojs-ui.js
authorAlan Knowles <alan@roojs.com>
Thu, 26 Sep 2019 02:11:24 +0000 (10:11 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 26 Sep 2019 02:11:24 +0000 (10:11 +0800)
roojs-ui-debug.js
roojs-bootstrap.js
roojs-bootstrap-debug.js
roojs-all.js
roojs-debug.js
Roo/HtmlEditorCore.js

Roo/HtmlEditorCore.js
roojs-all.js
roojs-bootstrap-debug.js
roojs-bootstrap.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index ab52b4c..16aef64 100644 (file)
@@ -1045,7 +1045,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
             
             if (lcname == 'span' &&
                 node.childNodes.length == 1 &&
-                node.childNodes[0].nodeName.toLowerCase() = 'span'
+                node.childNodes[0].nodeName.toLowerCase() == 'span'
             ) {
                 remove_keep_children = true;
             }
index f5f0b16..662dc5f 100644 (file)
@@ -1808,7 +1808,7 @@ var B=this.createRange(A);try{var p=B.commonAncestorContainer;while(p.nodeType==
 var D=ss==1;var E=ee==-1;if(D&&E){return 0;}if(!D&&E){return 1;}if(D&&!E){return 2;}return 3;},cleanUpPaste:function(){Roo.log('cleanuppaste');this.cleanUpChildren(this.doc.body);var A=this.cleanWordChars(this.doc.body.innerHTML);if(A!=this.doc.body.innerHTML){this.doc.body.innerHTML=A;
 }},cleanWordChars:function(A){var he=Roo.HtmlEditorCore;var B=A;Roo.each(he.swapCodes,function(sw){var C=new RegExp("\\u"+sw[0].toString(16),"g");B=B.replace(C,sw[1]);});return B;},cleanUpChildren:function(n){if(!n.childNodes.length){return;}for(var i=n.childNodes.length-1;
 i>-1;i--){this.cleanUpChild(n.childNodes[i]);}},cleanUpChild:function(A){var ed=this;if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}var B=A.tagName.toLowerCase();if(this.black.indexOf(B)>-1&&this.clearUp){A.parentNode.removeChild(A);
-return;}var C=Roo.HtmlEditorCore.remove.indexOf(A.tagName.toLowerCase())>-1;if(!A.attributes||!A.attributes.length){if(B=='span'&&A.childNodes.length==1&&A.childNodes[0].tagName.toLowerCase()=='span'){C=true;}}if(C){this.cleanUpChildren(A);while(A.childNodes.length){var cn=A.childNodes[0];
+return;}var C=Roo.HtmlEditorCore.remove.indexOf(A.tagName.toLowerCase())>-1;if(!A.attributes||!A.attributes.length){if(B=='span'&&A.childNodes.length==1&&A.childNodes[0].nodeName.toLowerCase()=='span'){C=true;}}if(C){this.cleanUpChildren(A);while(A.childNodes.length){var cn=A.childNodes[0];
 A.removeChild(cn);A.parentNode.insertBefore(cn,A);}A.parentNode.removeChild(A);return;}if(!A.attributes||!A.attributes.length){this.cleanUpChildren(A);return;}function cleanAttr(n,v){if(v.match(/^\./)||v.match(/^\//)){return;}if(v.match(/^(http|https):\/\//)||v.match(/^mailto:/)||v.match(/^ftp:/)){return;
 }if(v.match(/^#/)){return;}A.removeAttribute(n);}var D=this.cwhite;var E=this.cblack;function cleanStyle(n,v){if(v.match(/expression/)){A.removeAttribute(n);return;}var F=v.split(/;/);var G=[];Roo.each(F,function(p){p=p.replace(/^\s+/g,'').replace(/\s+$/g,'');
 if(!p.length){return true;}var l=p.split(':').shift().replace(/\s+/g,'');l=l.replace(/^\s+/g,'').replace(/\s+$/g,'');if(D.length&&E.indexOf(l)>-1){return true;}if(D.length&&D.indexOf(l)<0){return true;}G.push(p);return true;});if(G.length){A.setAttribute(n,G.join(';'));
index 2a1b23d..6aadce8 100644 (file)
@@ -23025,6 +23025,17 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
         
         var remove_keep_children= Roo.HtmlEditorCore.remove.indexOf(node.tagName.toLowerCase()) > -1;
         
+        
+        if (!node.attributes || !node.attributes.length) {
+            
+            if (lcname == 'span' &&
+                node.childNodes.length == 1 &&
+                node.childNodes[0].nodeName.toLowerCase() = 'span'
+            ) {
+                remove_keep_children = true;
+            }
+        }
+        
         // remove <a name=....> as rendering on yahoo mailer is borked with this.
         // this will have to be flaged elsewhere - perhaps ablack=name... on the mailer..
         
@@ -23045,6 +23056,10 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
         }
         
         if (!node.attributes || !node.attributes.length) {
+            
+          
+            
+            
             this.cleanUpChildren(node);
             return;
         }
index 59a9038..07252e3 100644 (file)
@@ -966,18 +966,19 @@ var B=this.createRange(A);try{var p=B.commonAncestorContainer;while(p.nodeType==
 var D=ss==1;var E=ee==-1;if(D&&E){return 0;}if(!D&&E){return 1;}if(D&&!E){return 2;}return 3;},cleanUpPaste:function(){Roo.log('cleanuppaste');this.cleanUpChildren(this.doc.body);var A=this.cleanWordChars(this.doc.body.innerHTML);if(A!=this.doc.body.innerHTML){this.doc.body.innerHTML=A;
 }},cleanWordChars:function(A){var he=Roo.HtmlEditorCore;var B=A;Roo.each(he.swapCodes,function(sw){var C=new RegExp("\\u"+sw[0].toString(16),"g");B=B.replace(C,sw[1]);});return B;},cleanUpChildren:function(n){if(!n.childNodes.length){return;}for(var i=n.childNodes.length-1;
 i>-1;i--){this.cleanUpChild(n.childNodes[i]);}},cleanUpChild:function(A){var ed=this;if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}var B=A.tagName.toLowerCase();if(this.black.indexOf(B)>-1&&this.clearUp){A.parentNode.removeChild(A);
-return;}var C=Roo.HtmlEditorCore.remove.indexOf(A.tagName.toLowerCase())>-1;if(C){this.cleanUpChildren(A);while(A.childNodes.length){var cn=A.childNodes[0];A.removeChild(cn);A.parentNode.insertBefore(cn,A);}A.parentNode.removeChild(A);return;}if(!A.attributes||!A.attributes.length){this.cleanUpChildren(A);
-return;}function cleanAttr(n,v){if(v.match(/^\./)||v.match(/^\//)){return;}if(v.match(/^(http|https):\/\//)||v.match(/^mailto:/)||v.match(/^ftp:/)){return;}if(v.match(/^#/)){return;}A.removeAttribute(n);}var D=this.cwhite;var E=this.cblack;function cleanStyle(n,v){if(v.match(/expression/)){A.removeAttribute(n);
-return;}var F=v.split(/;/);var G=[];Roo.each(F,function(p){p=p.replace(/^\s+/g,'').replace(/\s+$/g,'');if(!p.length){return true;}var l=p.split(':').shift().replace(/\s+/g,'');l=l.replace(/^\s+/g,'').replace(/\s+$/g,'');if(D.length&&E.indexOf(l)>-1){return true;
-}if(D.length&&D.indexOf(l)<0){return true;}G.push(p);return true;});if(G.length){A.setAttribute(n,G.join(';'));}else{A.removeAttribute(n);}}for(var i=A.attributes.length-1;i>-1;i--){var a=A.attributes[i];if(a.name.toLowerCase().substr(0,2)=='on'){A.removeAttribute(a.name);
-continue;}if(Roo.HtmlEditorCore.ablack.indexOf(a.name.toLowerCase())>-1){A.removeAttribute(a.name);continue;}if(Roo.HtmlEditorCore.aclean.indexOf(a.name.toLowerCase())>-1){cleanAttr(a.name,a.value);continue;}if(a.name=='style'){cleanStyle(a.name,a.value);
-continue;}if(a.name=='class'){if(a.value.match(/^Mso/)){A.className='';}if(a.value.match(/^body$/)){A.className='';}continue;}}this.cleanUpChildren(A);},cleanWord:function(A){if(!A){this.cleanWord(this.doc.body);return;}if(A.nodeName=='SPAN'&&!A.hasAttributes()&&A.childNodes.length==1&&A.firstChild.nodeName=="#text"){var B=A.firstChild;
-A.removeChild(B);if(A.getAttribute('lang')!='zh-CN'){A.parentNode.insertBefore(A.ownerDocument.createTextNode(" "),A);}A.parentNode.insertBefore(B,A);if(A.getAttribute('lang')!='zh-CN'){A.parentNode.insertBefore(A.ownerDocument.createTextNode(" "),A);}A.parentNode.removeChild(A);
-}if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}if(A.tagName.toLowerCase().match(/^(style|script|applet|embed|noframes|noscript)$/)){A.parentNode.removeChild(A);return;}if(A.tagName.toLowerCase().match(/^(meta|link|\\?xml:|st1:|o:|font)/)){while(A.childNodes.length){var cn=A.childNodes[0];
-A.removeChild(cn);A.parentNode.insertBefore(cn,A);}A.parentNode.removeChild(A);this.iterateChildren(A,this.cleanWord);return;}if(A.className.length){var cn=A.className.split(/\W+/);var C=[];Roo.each(cn,function(F){if(F.match(/Mso[a-zA-Z]+/)){return;}C.push(F);
-});A.className=C.length?C.join(' '):'';if(!C.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var D=A.getAttribute("style").split(";");var E=[];Roo.each(D,function(s){if(!s.match(/:/)){return;
-}var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;}E.push(s);});A.setAttribute("style",E.length?E.join(';'):'');if(!E.length){A.removeAttribute('style');}}this.iterateChildren(A,this.cleanWord);},iterateChildren:function(A,fn){if(!A.childNodes.length){return;
-}for(var i=A.childNodes.length-1;i>-1;i--){fn.call(this,A.childNodes[i])}},cleanTableWidths:function(A){if(!A){this.cleanTableWidths(this.doc.body);return;}if(A.nodeName=="#text"||A.nodeName=="#comment"){return;}Roo.log(A.tagName);if(!A.tagName.toLowerCase().match(/^(table|td|tr)$/)){this.iterateChildren(A,this.cleanTableWidths);
+return;}var C=Roo.HtmlEditorCore.remove.indexOf(A.tagName.toLowerCase())>-1;if(!A.attributes||!A.attributes.length){if(B=='span'&&A.childNodes.length==1&&A.childNodes[0].nodeName.toLowerCase()='span'){C=true;}}if(C){this.cleanUpChildren(A);while(A.childNodes.length){var cn=A.childNodes[0];
+A.removeChild(cn);A.parentNode.insertBefore(cn,A);}A.parentNode.removeChild(A);return;}if(!A.attributes||!A.attributes.length){this.cleanUpChildren(A);return;}function cleanAttr(n,v){if(v.match(/^\./)||v.match(/^\//)){return;}if(v.match(/^(http|https):\/\//)||v.match(/^mailto:/)||v.match(/^ftp:/)){return;
+}if(v.match(/^#/)){return;}A.removeAttribute(n);}var D=this.cwhite;var E=this.cblack;function cleanStyle(n,v){if(v.match(/expression/)){A.removeAttribute(n);return;}var F=v.split(/;/);var G=[];Roo.each(F,function(p){p=p.replace(/^\s+/g,'').replace(/\s+$/g,'');
+if(!p.length){return true;}var l=p.split(':').shift().replace(/\s+/g,'');l=l.replace(/^\s+/g,'').replace(/\s+$/g,'');if(D.length&&E.indexOf(l)>-1){return true;}if(D.length&&D.indexOf(l)<0){return true;}G.push(p);return true;});if(G.length){A.setAttribute(n,G.join(';'));
+}else{A.removeAttribute(n);}}for(var i=A.attributes.length-1;i>-1;i--){var a=A.attributes[i];if(a.name.toLowerCase().substr(0,2)=='on'){A.removeAttribute(a.name);continue;}if(Roo.HtmlEditorCore.ablack.indexOf(a.name.toLowerCase())>-1){A.removeAttribute(a.name);
+continue;}if(Roo.HtmlEditorCore.aclean.indexOf(a.name.toLowerCase())>-1){cleanAttr(a.name,a.value);continue;}if(a.name=='style'){cleanStyle(a.name,a.value);continue;}if(a.name=='class'){if(a.value.match(/^Mso/)){A.className='';}if(a.value.match(/^body$/)){A.className='';
+}continue;}}this.cleanUpChildren(A);},cleanWord:function(A){if(!A){this.cleanWord(this.doc.body);return;}if(A.nodeName=='SPAN'&&!A.hasAttributes()&&A.childNodes.length==1&&A.firstChild.nodeName=="#text"){var B=A.firstChild;A.removeChild(B);if(A.getAttribute('lang')!='zh-CN'){A.parentNode.insertBefore(A.ownerDocument.createTextNode(" "),A);
+}A.parentNode.insertBefore(B,A);if(A.getAttribute('lang')!='zh-CN'){A.parentNode.insertBefore(A.ownerDocument.createTextNode(" "),A);}A.parentNode.removeChild(A);}if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;
+}if(A.tagName.toLowerCase().match(/^(style|script|applet|embed|noframes|noscript)$/)){A.parentNode.removeChild(A);return;}if(A.tagName.toLowerCase().match(/^(meta|link|\\?xml:|st1:|o:|font)/)){while(A.childNodes.length){var cn=A.childNodes[0];A.removeChild(cn);
+A.parentNode.insertBefore(cn,A);}A.parentNode.removeChild(A);this.iterateChildren(A,this.cleanWord);return;}if(A.className.length){var cn=A.className.split(/\W+/);var C=[];Roo.each(cn,function(F){if(F.match(/Mso[a-zA-Z]+/)){return;}C.push(F);});A.className=C.length?C.join(' '):'';
+if(!C.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var D=A.getAttribute("style").split(";");var E=[];Roo.each(D,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;
+}E.push(s);});A.setAttribute("style",E.length?E.join(';'):'');if(!E.length){A.removeAttribute('style');}}this.iterateChildren(A,this.cleanWord);},iterateChildren:function(A,fn){if(!A.childNodes.length){return;}for(var i=A.childNodes.length-1;i>-1;i--){fn.call(this,A.childNodes[i])}
+},cleanTableWidths:function(A){if(!A){this.cleanTableWidths(this.doc.body);return;}if(A.nodeName=="#text"||A.nodeName=="#comment"){return;}Roo.log(A.tagName);if(!A.tagName.toLowerCase().match(/^(table|td|tr)$/)){this.iterateChildren(A,this.cleanTableWidths);
 return;}if(A.hasAttribute('width')){A.removeAttribute('width');}if(A.hasAttribute("style")){var B=A.getAttribute("style").split(";");var C=[];Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");if(kv[0].match(/^\s*(width|min-width)\s*$/)){return;
 }C.push(s);});A.setAttribute("style",C.length?C.join(';'):'');if(!C.length){A.removeAttribute('style');}}this.iterateChildren(A,this.cleanTableWidths);},domToHTML:function(A,B,C){B=B||0;C=C||false;if(!A){return this.domToHTML(this.doc.body);}var j;var D=false;
 var E=A.nodeName;var F=Roo.util.Format.htmlEncode(A.tagName);if(E=='#text'){return C?A.nodeValue:A.nodeValue.trim();}var G='';if(E!='BODY'){var i=0;if(F){var H=[];for(i=0;i<A.attributes.length;i++){var I=A.attributes.item(i).name;if(!A.attributes.item(i).value.length){continue;
index 5efd0f4..beb4a35 100644 (file)
@@ -43958,7 +43958,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
             
             if (lcname == 'span' &&
                 node.childNodes.length == 1 &&
-                node.childNodes[0].tagName.toLowerCase() == 'span'
+                node.childNodes[0].nodeName.toLowerCase() == 'span'
             ) {
                 remove_keep_children = true;
             }
index 6887e58..9880095 100644 (file)
@@ -21507,7 +21507,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
             
             if (lcname == 'span' &&
                 node.childNodes.length == 1 &&
-                node.childNodes[0].tagName.toLowerCase() == 'span'
+                node.childNodes[0].nodeName.toLowerCase() == 'span'
             ) {
                 remove_keep_children = true;
             }
index cd8a8a3..c985226 100644 (file)
@@ -939,7 +939,7 @@ var B=this.createRange(A);try{var p=B.commonAncestorContainer;while(p.nodeType==
 var D=ss==1;var E=ee==-1;if(D&&E){return 0;}if(!D&&E){return 1;}if(D&&!E){return 2;}return 3;},cleanUpPaste:function(){Roo.log('cleanuppaste');this.cleanUpChildren(this.doc.body);var A=this.cleanWordChars(this.doc.body.innerHTML);if(A!=this.doc.body.innerHTML){this.doc.body.innerHTML=A;
 }},cleanWordChars:function(A){var he=Roo.HtmlEditorCore;var B=A;Roo.each(he.swapCodes,function(sw){var C=new RegExp("\\u"+sw[0].toString(16),"g");B=B.replace(C,sw[1]);});return B;},cleanUpChildren:function(n){if(!n.childNodes.length){return;}for(var i=n.childNodes.length-1;
 i>-1;i--){this.cleanUpChild(n.childNodes[i]);}},cleanUpChild:function(A){var ed=this;if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}var B=A.tagName.toLowerCase();if(this.black.indexOf(B)>-1&&this.clearUp){A.parentNode.removeChild(A);
-return;}var C=Roo.HtmlEditorCore.remove.indexOf(A.tagName.toLowerCase())>-1;if(!A.attributes||!A.attributes.length){if(B=='span'&&A.childNodes.length==1&&A.childNodes[0].tagName.toLowerCase()=='span'){C=true;}}if(C){this.cleanUpChildren(A);while(A.childNodes.length){var cn=A.childNodes[0];
+return;}var C=Roo.HtmlEditorCore.remove.indexOf(A.tagName.toLowerCase())>-1;if(!A.attributes||!A.attributes.length){if(B=='span'&&A.childNodes.length==1&&A.childNodes[0].nodeName.toLowerCase()=='span'){C=true;}}if(C){this.cleanUpChildren(A);while(A.childNodes.length){var cn=A.childNodes[0];
 A.removeChild(cn);A.parentNode.insertBefore(cn,A);}A.parentNode.removeChild(A);return;}if(!A.attributes||!A.attributes.length){this.cleanUpChildren(A);return;}function cleanAttr(n,v){if(v.match(/^\./)||v.match(/^\//)){return;}if(v.match(/^(http|https):\/\//)||v.match(/^mailto:/)||v.match(/^ftp:/)){return;
 }if(v.match(/^#/)){return;}A.removeAttribute(n);}var D=this.cwhite;var E=this.cblack;function cleanStyle(n,v){if(v.match(/expression/)){A.removeAttribute(n);return;}var F=v.split(/;/);var G=[];Roo.each(F,function(p){p=p.replace(/^\s+/g,'').replace(/\s+$/g,'');
 if(!p.length){return true;}var l=p.split(':').shift().replace(/\s+/g,'');l=l.replace(/^\s+/g,'').replace(/\s+$/g,'');if(D.length&&E.indexOf(l)>-1){return true;}if(D.length&&D.indexOf(l)<0){return true;}G.push(p);return true;});if(G.length){A.setAttribute(n,G.join(';'));