From 4cd26e5c0b514988dc99d6d3fcbfb075b7983c54 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 7 Jul 2022 10:10:52 +0800 Subject: [PATCH] Changed Roo/htmleditor/FilterKeepChildren.js --- Roo/htmleditor/FilterKeepChildren.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Roo/htmleditor/FilterKeepChildren.js b/Roo/htmleditor/FilterKeepChildren.js index de742375e7..ec1e5f02a4 100644 --- a/Roo/htmleditor/FilterKeepChildren.js +++ b/Roo/htmleditor/FilterKeepChildren.js @@ -12,12 +12,17 @@ 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) { @@ -25,12 +30,15 @@ Roo.extend(Roo.htmleditor.FilterKeepChildren, Roo.htmleditor.FilterBlack, //Roo.log(node); 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; -- 2.39.2