Roo/htmleditor/TidyWriter.js
authorAlan <alan@roojs.com>
Thu, 6 Jan 2022 08:59:02 +0000 (16:59 +0800)
committerAlan <alan@roojs.com>
Thu, 6 Jan 2022 08:59:02 +0000 (16:59 +0800)
Roo/htmleditor/TidyEntities.js

Roo/htmleditor/TidyEntities.js
Roo/htmleditor/TidyWriter.js

index eed147b..374564e 100644 (file)
@@ -712,8 +712,10 @@ Roo.htmleditor.TidyEntities = {
      * @param {String} text Text to entity decode.
      * @return {String} Entity decoded string.
      */
-    decode: function(text) {
-        return text.replace(entityRegExp, function(all, numeric) {
+    decode: function(text)
+    {
+        var  t = this;
+        return text.replace(this.entityRegExp, function(all, numeric) {
             if (numeric) {
                 numeric = 'x' === numeric.charAt(0).toLowerCase() ? parseInt(numeric.substr(1), 16) : parseInt(numeric, 10);
                 // Support upper UTF
@@ -721,15 +723,28 @@ Roo.htmleditor.TidyEntities = {
                     numeric -= 65536;
                     return String.fromCharCode(55296 + (numeric >> 10), 56320 + (1023 & numeric));
                 }
-                return asciiMap[numeric] || String.fromCharCode(numeric);
+                return t.asciiMap[numeric] || String.fromCharCode(numeric);
             }
-            return reverseEntities[all] || namedEntities[all] || nativeDecode(all);
+            return t.reverseEntities[all] || t.namedEntities[all] || t.nativeDecode(all);
         });
-    }
-    function nativeDecode(text) {
+    },
+    nativeDecode : function (text) {
         return text;
-    }
-makeMap
+    },
+    makeMap : function (items, delim, map) {
+               var i;
+               items = items || [];
+               delim = delim || ',';
+               if (typeof items == "string") {
+                       items = items.split(delim);
+               }
+               map = map || {};
+               i = items.length;
+               while (i--) {
+                       map[items[i]] = {};
+               }
+               return map;
+       },
     
     
     
index 2bc296e..c0e3500 100644 (file)
@@ -17,26 +17,21 @@ Roo.htmleditor.TidyWriter = function(settings)
     this.htmlOutput = 'html' == settings.element_format;
 }
 Roo.apply(Roo.htmleditor.TidyWriter,
-          {
-     
+{
+
 
     makeMap : function (items, delim, map) {
                var i;
-
                items = items || [];
                delim = delim || ',';
-
                if (typeof items == "string") {
                        items = items.split(delim);
                }
-
                map = map || {};
-
                i = items.length;
                while (i--) {
                        map[items[i]] = {};
                }
-
                return map;
        },