sync
authorAlan <alan@roojs.com>
Fri, 7 Jan 2022 08:15:26 +0000 (16:15 +0800)
committerAlan <alan@roojs.com>
Fri, 7 Jan 2022 08:15:26 +0000 (16:15 +0800)
Roo/HtmlEditorCore.js
docs/json/roodata.json
docs/tree.json

index 59011b8..96360d6 100644 (file)
@@ -361,10 +361,15 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
             var bd = (this.doc.body || this.doc.documentElement);
            
             
+            var sel = this.win.getSelection();
             
             var div = document.createElement('div');
             div.innerHTML = bd.innerHTML;
-            
+            var gtx = div.getElementsByClassName('gtx-trans-icon'); // google translate - really annoying and difficult to get rid of.
+            if (gtx.length > 0) {
+                var rm = gtx.item(0).parentNode;
+                rm.parentNode.removeChild(rm);
+            }
             
            
             if (this.enableBlocks) {
index b948a01..2f1075e 100644 (file)
     "tree_children" : [],
     "tree_parent" : []
   },
-  "Roo.htmleditor.Tidy" : {
-    "props" : [
+  "Roo.htmleditor.TidyEntities" : {
+    "props" : [],
+    "events" : [],
+    "methods" : [
       {
-        "name" : "core",
-        "type" : "Roo.HtmlEditorCore",
-        "desc" : "the editor.",
-        "memberOf" : ""
+        "name" : "decode",
+        "type" : "function",
+        "desc" : "Decodes the specified string, this will replace entities with raw UTF characters.",
+        "sig" : "(text)",
+        "static" : true,
+        "memberOf" : "",
+        "isStatic" : true,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "Text to entity decode.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : [
+          {
+            "name" : "",
+            "type" : "String",
+            "desc" : "Entity decoded string."
+          }
+        ]
+      },
+      {
+        "name" : "encodeAllRaw",
+        "type" : "function",
+        "desc" : "Encoded the specified text with both the attributes and text entities. This function will produce larger text contents\nsince it doesn't know if the context is within a attribute or text node. This was added for compatibility\nand is exposed as the DOMUtils.encode function.",
+        "sig" : "(text)",
+        "static" : true,
+        "memberOf" : "",
+        "isStatic" : true,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "Text to encode.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : [
+          {
+            "name" : "",
+            "type" : "String",
+            "desc" : "Entity encoded text."
+          }
+        ]
+      },
+      {
+        "name" : "encodeNamed",
+        "type" : "function",
+        "desc" : "Encodes the specified string using named entities. The core entities will be encoded\nas named ones but all non lower ascii characters will be encoded into named entities.",
+        "sig" : "(text, attr, entities)",
+        "static" : true,
+        "memberOf" : "",
+        "isStatic" : true,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "Text to encode.",
+            "isOptional" : false
+          },
+          {
+            "name" : "attr",
+            "type" : "Boolean",
+            "desc" : "Optional flag to specify if the text is attribute contents.",
+            "isOptional" : false
+          },
+          {
+            "name" : "entities",
+            "type" : "Object",
+            "desc" : "Optional parameter with entities to use.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : [
+          {
+            "name" : "",
+            "type" : "String",
+            "desc" : "Entity encoded text."
+          }
+        ]
+      },
+      {
+        "name" : "encodeNumeric",
+        "type" : "function",
+        "desc" : "Encodes the specified string using numeric entities. The core entities will be\nencoded as named ones but all non lower ascii characters will be encoded into numeric entities.",
+        "sig" : "(text, attr)",
+        "static" : true,
+        "memberOf" : "",
+        "isStatic" : true,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "Text to encode.",
+            "isOptional" : false
+          },
+          {
+            "name" : "attr",
+            "type" : "Boolean",
+            "desc" : "Optional flag to specify if the text is attribute contents.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : [
+          {
+            "name" : "",
+            "type" : "String",
+            "desc" : "Entity encoded text."
+          }
+        ]
+      },
+      {
+        "name" : "encodeRaw",
+        "type" : "function",
+        "desc" : "Encodes the specified string using raw entities. This means only the required XML base entities will be encoded.",
+        "sig" : "(text, attr)",
+        "static" : true,
+        "memberOf" : "",
+        "isStatic" : true,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "Text to encode.",
+            "isOptional" : false
+          },
+          {
+            "name" : "attr",
+            "type" : "Boolean",
+            "desc" : "Optional flag to specify if the text is attribute contents.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : [
+          {
+            "name" : "",
+            "type" : "String",
+            "desc" : "Entity encoded text."
+          }
+        ]
+      },
+      {
+        "name" : "getEncodeFunc",
+        "type" : "function",
+        "desc" : "Returns an encode function based on the name(s) and it's optional entities.",
+        "sig" : "(name, entities)",
+        "static" : true,
+        "memberOf" : "",
+        "isStatic" : true,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "name",
+            "type" : "String",
+            "desc" : "Comma separated list of encoders for example named,numeric.",
+            "isOptional" : false
+          },
+          {
+            "name" : "entities",
+            "type" : "String",
+            "desc" : "Optional parameter with entities to use instead of the built in set.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : [
+          {
+            "name" : "",
+            "type" : "function",
+            "desc" : "Encode function to be used."
+          }
+        ]
+      },
+      {
+        "name" : "init",
+        "type" : "function",
+        "desc" : "initialize data..",
+        "sig" : "()\n{\n\n}",
+        "static" : true,
+        "memberOf" : "",
+        "isStatic" : true,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [],
+        "returns" : []
       }
     ],
+    "isAbstract" : false,
+    "isBuilderTop" : false,
+    "implementations" : [],
+    "tree_children" : [],
+    "tree_parent" : []
+  },
+  "Roo.htmleditor.TidySerializer" : {
+    "props" : [],
     "events" : [],
-    "methods" : [],
+    "methods" : [
+      {
+        "name" : "inner",
+        "type" : "function",
+        "desc" : "",
+        "sig" : "(inner)",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "inner",
+            "type" : "boolean",
+            "desc" : "do the inner of the node.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : []
+      },
+      {
+        "name" : "serialize",
+        "type" : "function",
+        "desc" : "Serializes the specified node into a string.",
+        "sig" : "(node)",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('<p>text</p>'));",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "node",
+            "type" : "DomElement",
+            "desc" : "Node instance to serialize.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : [
+          {
+            "name" : "",
+            "type" : "String",
+            "desc" : "String with HTML based on DOM tree."
+          }
+        ]
+      }
+    ],
+    "isAbstract" : false,
+    "isBuilderTop" : false,
+    "implementations" : [],
+    "tree_children" : [],
+    "tree_parent" : []
+  },
+  "Roo.htmleditor.TidyWriter" : {
+    "props" : [],
+    "events" : [],
+    "methods" : [
+      {
+        "name" : "cdata",
+        "type" : "function",
+        "desc" : "Writes a cdata node such as <![CDATA[data]]>.",
+        "sig" : "(text)",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "String to write out inside the cdata.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : []
+      },
+      {
+        "name" : "comment",
+        "type" : "function",
+        "desc" : "Writes a comment node such as <!-- Comment -->.",
+        "sig" : "(text)",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "String to write out inside the comment.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : []
+      },
+      {
+        "name" : "doctype",
+        "type" : "function",
+        "desc" : "Writes a doctype node such as <!DOCTYPE data>.",
+        "sig" : "(text)",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "String to write out inside the doctype.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : []
+      },
+      {
+        "name" : "end",
+        "type" : "function",
+        "desc" : "Writes the a end element such as </p>.",
+        "sig" : "(name)",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "name",
+            "type" : "String",
+            "desc" : "Name of the element.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : []
+      },
+      {
+        "name" : "getContent",
+        "type" : "function",
+        "desc" : "Returns the contents that got serialized.",
+        "sig" : "()\n{\n\n}",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [],
+        "returns" : [
+          {
+            "name" : "",
+            "type" : "String",
+            "desc" : "HTML contents that got written down."
+          }
+        ]
+      },
+      {
+        "name" : "pi",
+        "type" : "function",
+        "desc" : "Writes a PI node such as <?xml attr=\"value\" ?>.",
+        "sig" : "(name, text)",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "name",
+            "type" : "String",
+            "desc" : "Name of the pi.",
+            "isOptional" : false
+          },
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "String to write out inside the pi.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : []
+      },
+      {
+        "name" : "reset",
+        "type" : "function",
+        "desc" : "Resets the internal buffer if one wants to reuse the writer.",
+        "sig" : "()\n{\n\n}",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [],
+        "returns" : []
+      },
+      {
+        "name" : "start",
+        "type" : "function",
+        "desc" : "Writes the a start element such as <p id=\"a\">.",
+        "sig" : "(name, attrs, empty)",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "name",
+            "type" : "String",
+            "desc" : "Name of the element.",
+            "isOptional" : false
+          },
+          {
+            "name" : "attrs",
+            "type" : "Array",
+            "desc" : "Optional attribute array or undefined if it hasn't any.",
+            "isOptional" : false
+          },
+          {
+            "name" : "empty",
+            "type" : "Boolean",
+            "desc" : "Optional empty state if the tag should end like <br />.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : []
+      },
+      {
+        "name" : "text",
+        "type" : "function",
+        "desc" : "Writes a text node.\n\nIn pre - we should not mess with the contents.",
+        "sig" : "(text, raw)",
+        "static" : false,
+        "memberOf" : "",
+        "isStatic" : false,
+        "isConstructor" : false,
+        "isPrivate" : false,
+        "example" : "",
+        "deprecated" : "",
+        "since" : "",
+        "see" : "",
+        "exceptions" : "",
+        "requires" : "",
+        "params" : [
+          {
+            "name" : "text",
+            "type" : "String",
+            "desc" : "String to write out.",
+            "isOptional" : false
+          },
+          {
+            "name" : "raw",
+            "type" : "Boolean",
+            "desc" : "Optional raw state if true the contents wont get encoded.",
+            "isOptional" : false
+          }
+        ],
+        "returns" : []
+      }
+    ],
     "isAbstract" : false,
     "isBuilderTop" : false,
     "implementations" : [],
index 4a58501..ee49378 100644 (file)
             "is_class" : false
           },
           {
-            "name" : "Roo.htmleditor.Tidy",
+            "name" : "Roo.htmleditor.TidyEntities",
             "cn" : [],
-            "is_class" : false
+            "is_class" : true
+          },
+          {
+            "name" : "Roo.htmleditor.TidySerializer",
+            "cn" : [],
+            "is_class" : true
+          },
+          {
+            "name" : "Roo.htmleditor.TidyWriter",
+            "cn" : [],
+            "is_class" : true
           }
         ],
         "is_class" : false