sync
authorAlan <alan@roojs.com>
Fri, 24 Sep 2021 02:53:41 +0000 (10:53 +0800)
committerAlan <alan@roojs.com>
Fri, 24 Sep 2021 02:53:41 +0000 (10:53 +0800)
Roo/htmleditor/FilterBlack.js
Roo/htmleditor/FilterComment.js
Roo/htmleditor/FilterKeepChildren.js
Roo/htmleditor/FilterParagraph.js
Roo/htmleditor/FilterSpan.js
Roo/htmleditor/FilterTableWidth.js
Roo/htmleditor/FilterWord.js
docs/json/roodata.json
docs/src/Roo_htmleditor_FilterAttributes.js.html
docs/src/Roo_htmleditor_FilterBlack.js.html
docs/tree.json

index b908561..e5d3863 100644 (file)
@@ -24,27 +24,15 @@ Roo.htmleditor.FilterBlack = function(cfg)
 
 Roo.extend(Roo.htmleditor.FilterBlack, Roo.htmleditor.Filter,
 {
-Roo.htmleditor.FilterBlack =  {
+    tag : true, // all elements.
     /**
      * @cfg {array} black blacklist of elements
      */
     black : false, // array
     
-    walkWith : function(node, black)
-    {
-        this.black = black;
-        this.walk(node);
-    },
-    
-      
-    walk : function (node)
-    {
-       Roo.htmleditor.Filter.walk.call(this, node, this.black);
      
-    },
-    
     replace : function(n)
     {
         n.parentNode.removeChild(n);
     }
-};
+});
index b29ff56..02e28cf 100644 (file)
@@ -1,23 +1,20 @@
 /**
- * Filter Comments
- *
- * Remove Comments..
- * 
- * 
- * 
- *
+ * @class Roo.htmleditor.FilterComment
+ * remove comments.
+ * @constructor
+* Run a new Comments Filter
+* @param {Object} config Configuration options
  */
+Roo.htmleditor.FilterComment = function(cfg)
+{
+    this.walk(cfg.node);
+}
 
-Roo.htmleditor.FilterComment =  {
-
-
-    walk : function (node)
-    {
-        Roo.htmleditor.Filter.walk.call(this, node, false);
-     
-    },
+Roo.extend(Roo.htmleditor.FilterComment, Roo.htmleditor.Filter,
+{
+  
     replaceComment : function(n)
     {
-            n.parentNode.removeChild(n);
+        n.parentNode.removeChild(n);
     }
-}
\ No newline at end of file
+});
\ No newline at end of file
index b74027f..3e28c50 100644 (file)
@@ -1,23 +1,22 @@
 /**
- *  remove tags but keep children
+ * @class Roo.htmleditor.FilterKeepChildren
+ * remove tags but keep children
+ * @constructor
+ * Run a new Keep Children Filter
+ * @param {Object} config Configuration options
  */
-Roo.htmleditor.FilterKeepChildren =  {
+
+Roo.htmleditor.FilterKeepChildren = function(cfg)
+{
+    Roo.apply(this, cfg);
+    this.walk(cfg.node);
+}
+
+Roo.extend(Roo.htmleditor.FilterKeepChildren, Roo.htmleditor.FilterBlack,
+{
     
-    black : false, // array
-    walkWith : function (node, black)
-    {
-        this.black = black;
-        this.walk(node);
-     
-    },
-    walk : function (node)
-    {
-        Roo.htmleditor.Filter.walk.call(this, node, this.black);
-     
-    },
-    
-     
-    replace : function(n)
+  
+    replaceTag : function(n)
     {
         // walk children...
         for (var i = 0; i < node.childNodes.length; i++) {
index c782d96..4b91239 100644 (file)
@@ -1,23 +1,26 @@
 /**
- * Filter Paragraph
- *
+ * @class Roo.htmleditor.FilterParagraph
  * paragraphs cause a nightmare for shared content - this filter is designed to be called ? at various points when editing
  * like on 'push' to remove the <p> tags and replace them with line breaks.
- * 
- * 
- *
+ * @constructor
+ * Run a new Paragraph Filter
+ * @param {Object} config Configuration options
  */
 
-Roo.htmleditor.FilterParagraph  =  {
+Roo.htmleditor.FilterParagraph = function(cfg)
+{
+    // no need to apply config.
+    this.walk(cfg.node);
+}
+
+Roo.extend(Roo.htmleditor.FilterParagraph, Roo.htmleditor.Filter,
+{
     
-    walk : function (body)
-    {
-        Roo.htmleditor.Filter.walk.call(this, body, 'P');
-     
-    },
      
+    tag : 'P',
+    
      
-    replace : function(node)
+    replaceTag : function(node)
     {
         
         if (node.childNodes.length == 1 &&
index f3ee4f7..8ea28a2 100644 (file)
@@ -1,16 +1,24 @@
-
 /**
- *  filter span's with no attributes out..
+ * @class Roo.htmleditor.FilterSpan
+ * filter span's with no attributes out..
+ * @constructor
+ * Run a new Span Filter
+ * @param {Object} config Configuration options
  */
 
-Roo.htmleditor.FilterSpan =  {
+Roo.htmleditor.FilterSpan = function(cfg)
+{
+    // no need to apply config.
+    this.walk(cfg.node);
+}
 
-    walk : function (node)
-    {
-        Roo.htmleditor.Filter.walk.call(this, 'SPAN', true );
+Roo.extend(Roo.htmleditor.FilterSpan, Roo.htmleditor.Filter,
+{
+     
+    tag : 'SPAN',
      
-    },
-    replace : function(node)
+    replaceTag : function(node)
     {
         if (node.attributes && node.attributes.length > 0) {
             this.walk(node);
@@ -27,4 +35,4 @@ Roo.htmleditor.FilterSpan =  {
      
     }
     
-};
\ No newline at end of file
+});
\ No newline at end of file
index 200c258..1484642 100644 (file)
@@ -1,23 +1,30 @@
 /**
- *
* try and remove table width data - as that frequently messes up other stuff.
+ * @class Roo.htmleditor.FilterTableWidth
+  try and remove table width data - as that frequently messes up other stuff.
  * 
  *      was cleanTableWidths.
  *
  * Quite often pasting from word etc.. results in tables with column and widths.
  * This does not work well on fluid HTML layouts - like emails. - so this code should hunt an destroy them..
  *
+ * @constructor
+ * Run a new Table Filter
+ * @param {Object} config Configuration options
  */
 
-Roo.htmleditor.FilterParagraph  =   {
-    
-    walk: function (body)
-    {
-        Roo.htmleditor.Filter.walk.call(this, body, ['TABLE', 'TD', 'TR', 'TH', 'THEAD', 'TBODY' ]); 
-    },
-    
+Roo.htmleditor.FilterTableWidth = function(cfg)
+{
+    // no need to apply config.
+    this.tag = ['TABLE', 'TD', 'TR', 'TH', 'THEAD', 'TBODY' ];
+    this.walk(cfg.node);
+}
+
+Roo.extend(Roo.htmleditor.FilterTableWidth, Roo.htmleditor.Filter,
+{
+     
+     
     
-    replace: function(node) {
+    replaceTag: function(node) {
         
         
       
@@ -50,4 +57,4 @@ Roo.htmleditor.FilterParagraph  =   {
         
         this.walk(node);
     }
-};
\ No newline at end of file
+});
\ No newline at end of file
index 22ec9f9..abb06ab 100644 (file)
@@ -1,21 +1,29 @@
 /**
- *
+ * @class Roo.htmleditor.FilterWord
  * try and clean up all the mess that Word generates.
  * 
  * This is the 'nice version' - see 'Heavy' that white lists a very short list of elements, and multi-filters 
- *
+ * @constructor
+ * Run a new Span Filter
+ * @param {Object} config Configuration options
  */
-Roo.htmleditor.FilterWord  =   {
-    
-    walk: function (node)
-    {
-         Roo.htmleditor.Filter.walk.call(this, node, true);
-    },
+
+Roo.htmleditor.FilterWord = function(cfg)
+{
+    // no need to apply config.
+    this.walk(cfg.node);
+}
+
+Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter,
+{
+    tag: true,
+     
     
     /**
      * Clean up MS wordisms...
      */
-    replace : function(node)
+    replaceTag : function(node)
     {
          
         // no idea what this does - span with text, replaceds with just text.
@@ -54,7 +62,7 @@ Roo.htmleditor.FilterWord  =   {
                 node.removeChild(cn);
                 node.parentNode.insertBefore(cn, node);
                 // move node to parent - and clean it..
-                this.replace(cn);
+                this.replaceTag(cn);
             }
             node.parentNode.removeChild(node);
             /// no need to iterate chidlren = it's got none..
index c6790cc..f46b5de 100644 (file)
     "tree_children" : [],
     "tree_parent" : []
   },
+  "Roo.htmleditor.FilterBlack" : {
+    "props" : [
+      {
+        "name" : "black",
+        "type" : "array",
+        "desc" : "blacklist of elements",
+        "memberOf" : ""
+      }
+    ],
+    "events" : [],
+    "methods" : [],
+    "isAbstract" : false,
+    "isBuilderTop" : false,
+    "implementations" : [],
+    "tree_children" : [],
+    "tree_parent" : []
+  },
   "Roo.lib" : {
     "props" : [],
     "events" : [],
index b439036..6c7deff 100644 (file)
@@ -4,8 +4,8 @@
  * @class Roo.htmleditor.FilterAttributes
  * clean attributes and  styles including http:// etc.. in attribute
  * @constructor
- * Create a new Filter.
- * @param {Object} config Configuration options
+* Run a new Attribute Filter
+* @param {Object} config Configuration options
  */
 </span><span class="jsdoc-var">Roo.htmleditor.FilterAttributes </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">cfg</span><span class="jsdoc-syntax">)
 {
index b18544f..03c94aa 100644 (file)
@@ -8,9 +8,28 @@
  *
  */
 
-</span><span class="jsdoc-var">Roo.htmleditor.FilterBlack </span><span class="jsdoc-syntax">=  {
+/**
+ * @class Roo.htmleditor.FilterBlack
+ * remove blacklisted elements.
+ * @constructor
+ * Run a new Blacklisted Filter
+ * @param {Object} config Configuration options
+ */
+
+</span><span class="jsdoc-var">Roo.htmleditor.FilterBlack </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">cfg</span><span class="jsdoc-syntax">)
+{
+    </span><span class="jsdoc-var">Roo.apply</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">cfg</span><span class="jsdoc-syntax">);
+    </span><span class="jsdoc-var">this.walk</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">cfg.node</span><span class="jsdoc-syntax">);
+}
 
+</span><span class="jsdoc-var">Roo.extend</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">Roo.htmleditor.FilterBlack</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">Roo.htmleditor.Filter</span><span class="jsdoc-syntax">,
+{
+</span><span class="jsdoc-var">Roo.htmleditor.FilterBlack </span><span class="jsdoc-syntax">=  {
+    </span><span class="jsdoc-comment">/**
+     * @cfg {array} black blacklist of elements
+     */
     </span><span class="jsdoc-var">black </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">false</span><span class="jsdoc-syntax">, </span><span class="jsdoc-comment">// array
+
     </span><span class="jsdoc-var">walkWith </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">node</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">black</span><span class="jsdoc-syntax">)
     {
         </span><span class="jsdoc-var">this.black </span><span class="jsdoc-syntax">= </span><span class="jsdoc-var">black</span><span class="jsdoc-syntax">;
index 6cdd724..81b21a7 100644 (file)
             "name" : "Roo.htmleditor.FilterAttributes",
             "cn" : [],
             "is_class" : false
+          },
+          {
+            "name" : "Roo.htmleditor.FilterBlack",
+            "cn" : [],
+            "is_class" : false
           }
         ],
         "is_class" : false