Roo/htmleditor/FilterEmpty.js
authorleon <leon@roojs.com>
Tue, 27 Feb 2024 02:18:03 +0000 (10:18 +0800)
committerleon <leon@roojs.com>
Tue, 27 Feb 2024 02:18:03 +0000 (10:18 +0800)
Roo/htmleditor/FilterEmpty.js

index 59577f6..30a64c7 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * @class Roo.htmleditor.FilterEmpty
- * filter empty elements (normally <B> on paste)
+ * filter empty elements
  * @constructor
  * Run a new Empty Filter
  * @param {Object} config Configuration options
@@ -20,11 +20,15 @@ Roo.extend(Roo.htmleditor.FilterEmpty, Roo.htmleditor.FilterBlack,
  
     replaceTag : function(node)
     {
+        // start from child
         if(node.hasChildNodes()) {
             node.walk();
         }
 
-        if(['B', 'I', 'U', 'S'].indexOf(node.tagName) > -1))
+        //
+        if(['B', 'I', 'U', 'S'].indexOf(node.tagName) < 0) {
+            return;
+        }
         if (node.attributes && node.attributes.length > 0 || node.childNodes.length > 0) {
             return true;
         }