Changed Roo/htmleditor/FilterKeepChildren.js
authorAlan <alan@roojs.com>
Thu, 7 Jul 2022 02:10:52 +0000 (10:10 +0800)
committerAlan <alan@roojs.com>
Thu, 7 Jul 2022 02:10:52 +0000 (10:10 +0800)
Roo/htmleditor/FilterKeepChildren.js

index de74237..ec1e5f0 100644 (file)
@@ -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;