From: Alan Date: Thu, 7 Jul 2022 02:13:33 +0000 (+0800) Subject: roojs-ui.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=0a668022ba6654618a8f9b0774b233ff5c03ea96 roojs-ui.js roojs-ui-debug.js roojs-bootstrap.js roojs-bootstrap-debug.js roojs-all.js roojs-debug.js --- diff --git a/roojs-all.js b/roojs-all.js index 4681811e9e..c727dc977a 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1910,9 +1910,9 @@ Roo.htmleditor.FilterBlack=function(A){Roo.apply(this,A);this.walk(A.node);};Roo // Roo/htmleditor/FilterComment.js Roo.htmleditor.FilterComment=function(A){this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterComment,Roo.htmleditor.Filter,{replaceComment:function(n){n.parentNode.removeChild(n);}}); // Roo/htmleditor/FilterKeepChildren.js -Roo.htmleditor.FilterKeepChildren=function(A){Roo.apply(this,A);if(this.tag===false){return;}this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterKeepChildren,Roo.htmleditor.FilterBlack,{replaceTag:function(A){var ar=Array.from(A.childNodes);for(var i=0;i-1)||(typeof(this.tag)=='string'&&this.tag==ar[i].tagName)){this.replaceTag(ar[i]);continue;}}}ar=Array.from(A.childNodes);for(var i=0;i-1)){this.cleanNamespace=true;}this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterKeepChildren,Roo.htmleditor.FilterBlack,{cleanNamespace:false,replaceTag:function(A){Roo.log(A.tagName); +var ar=Array.from(A.childNodes);for(var i=0;i-1)||(typeof(this.tag)=='string'&&this.tag==ar[i].tagName)||this.cleanNameSpace&&ar[i].tagName.match(/:/)){this.replaceTag(ar[i]); +continue;}}}ar=Array.from(A.childNodes);for(var i=0;i -1)) { + this.cleanNamespace = true; + } + this.walk(cfg.node); } Roo.extend(Roo.htmleditor.FilterKeepChildren, Roo.htmleditor.FilterBlack, { - + cleanNamespace : false, // should really be an option, rather than using ':' inside of this tag. replaceTag : function(node) { // walk children... - //Roo.log(node); + Roo.log(node.tagName); var ar = Array.from(node.childNodes); //remove first.. + for (var i = 0; i < ar.length; i++) { if (ar[i].nodeType == 1) { if ( (typeof(this.tag) == 'object' && this.tag.indexOf(ar[i].tagName) > -1) || // array and it matches (typeof(this.tag) == 'string' && this.tag == ar[i].tagName) + || + this.cleanNameSpace && ar[i].tagName.match(/:/) ) { this.replaceTag(ar[i]); // child is blacklisted as well... continue; diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 4e42197289..ed4be500d7 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1129,9 +1129,9 @@ Roo.htmleditor.FilterBlack=function(A){Roo.apply(this,A);this.walk(A.node);};Roo // Roo/htmleditor/FilterComment.js Roo.htmleditor.FilterComment=function(A){this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterComment,Roo.htmleditor.Filter,{replaceComment:function(n){n.parentNode.removeChild(n);}}); // Roo/htmleditor/FilterKeepChildren.js -Roo.htmleditor.FilterKeepChildren=function(A){Roo.apply(this,A);if(this.tag===false){return;}this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterKeepChildren,Roo.htmleditor.FilterBlack,{replaceTag:function(A){var ar=Array.from(A.childNodes);for(var i=0;i-1)||(typeof(this.tag)=='string'&&this.tag==ar[i].tagName)){this.replaceTag(ar[i]);continue;}}}ar=Array.from(A.childNodes);for(var i=0;i-1)){this.cleanNamespace=true;}this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterKeepChildren,Roo.htmleditor.FilterBlack,{cleanNamespace:false,replaceTag:function(A){Roo.log(A.tagName); +var ar=Array.from(A.childNodes);for(var i=0;i-1)||(typeof(this.tag)=='string'&&this.tag==ar[i].tagName)||this.cleanNameSpace&&ar[i].tagName.match(/:/)){this.replaceTag(ar[i]); +continue;}}}ar=Array.from(A.childNodes);for(var i=0;i -1)) { + this.cleanNamespace = true; + } + this.walk(cfg.node); } Roo.extend(Roo.htmleditor.FilterKeepChildren, Roo.htmleditor.FilterBlack, { - + cleanNamespace : false, // should really be an option, rather than using ':' inside of this tag. replaceTag : function(node) { // walk children... - //Roo.log(node); + Roo.log(node.tagName); var ar = Array.from(node.childNodes); //remove first.. + for (var i = 0; i < ar.length; i++) { if (ar[i].nodeType == 1) { if ( (typeof(this.tag) == 'object' && this.tag.indexOf(ar[i].tagName) > -1) || // array and it matches (typeof(this.tag) == 'string' && this.tag == ar[i].tagName) + || + this.cleanNameSpace && ar[i].tagName.match(/:/) ) { this.replaceTag(ar[i]); // child is blacklisted as well... continue; diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 22d5aeb0d4..61eedc0f1e 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -21407,25 +21407,33 @@ Roo.htmleditor.FilterKeepChildren = function(cfg) if (this.tag === false) { return; // dont walk.. (you can use this to use this just to do a child removal on a single tag ) } + // hacky? + if ((typeof(this.tag) == 'object' && this.tag.indexOf(":") > -1)) { + this.cleanNamespace = true; + } + this.walk(cfg.node); } Roo.extend(Roo.htmleditor.FilterKeepChildren, Roo.htmleditor.FilterBlack, { - + cleanNamespace : false, // should really be an option, rather than using ':' inside of this tag. replaceTag : function(node) { // walk children... - //Roo.log(node); + Roo.log(node.tagName); var ar = Array.from(node.childNodes); //remove first.. + for (var i = 0; i < ar.length; i++) { if (ar[i].nodeType == 1) { if ( (typeof(this.tag) == 'object' && this.tag.indexOf(ar[i].tagName) > -1) || // array and it matches (typeof(this.tag) == 'string' && this.tag == ar[i].tagName) + || + this.cleanNameSpace && ar[i].tagName.match(/:/) ) { this.replaceTag(ar[i]); // child is blacklisted as well... continue; diff --git a/roojs-ui.js b/roojs-ui.js index fd99407aa6..3628c09ce2 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -964,9 +964,9 @@ Roo.htmleditor.FilterBlack=function(A){Roo.apply(this,A);this.walk(A.node);};Roo // Roo/htmleditor/FilterComment.js Roo.htmleditor.FilterComment=function(A){this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterComment,Roo.htmleditor.Filter,{replaceComment:function(n){n.parentNode.removeChild(n);}}); // Roo/htmleditor/FilterKeepChildren.js -Roo.htmleditor.FilterKeepChildren=function(A){Roo.apply(this,A);if(this.tag===false){return;}this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterKeepChildren,Roo.htmleditor.FilterBlack,{replaceTag:function(A){var ar=Array.from(A.childNodes);for(var i=0;i-1)||(typeof(this.tag)=='string'&&this.tag==ar[i].tagName)){this.replaceTag(ar[i]);continue;}}}ar=Array.from(A.childNodes);for(var i=0;i-1)){this.cleanNamespace=true;}this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterKeepChildren,Roo.htmleditor.FilterBlack,{cleanNamespace:false,replaceTag:function(A){Roo.log(A.tagName); +var ar=Array.from(A.childNodes);for(var i=0;i-1)||(typeof(this.tag)=='string'&&this.tag==ar[i].tagName)||this.cleanNameSpace&&ar[i].tagName.match(/:/)){this.replaceTag(ar[i]); +continue;}}}ar=Array.from(A.childNodes);for(var i=0;i