JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6
[ckeditor.git] / _source / plugins / entities / plugin.js
index f8329cd..8dac27f 100644 (file)
@@ -6,7 +6,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 (function()\r
 {\r
        // Base HTML entities.\r
-       var htmlbase = 'nbsp,gt,lt';\r
+       var htmlbase = 'nbsp,gt,lt,amp';\r
 \r
        var entities =\r
                // Latin-1 Entities\r
@@ -61,7 +61,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                nbsp    : '\u00A0',             // IE | FF\r
                                shy             : '\u00AD',             // IE\r
                                gt              : '\u003E',             // IE | FF |   --   | Opera\r
-                               lt              : '\u003C'              // IE | FF | Safari | Opera\r
+                               lt              : '\u003C',             // IE | FF | Safari | Opera\r
+                               amp : '\u0026'          // ALL\r
                        };\r
 \r
                entities = entities.replace( /\b(nbsp|shy|gt|lt|amp)(?:,|$)/g, function( match, entity )\r
@@ -113,7 +114,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        if ( htmlFilter )\r
                        {\r
                                // Mandatory HTML base entities.\r
-                               var selectedEntities = htmlbase;\r
+                               var selectedEntities = '';\r
+\r
+                               if ( config.basicEntities !== false )\r
+                                       selectedEntities += htmlbase;\r
 \r
                                if ( config.entities )\r
                                {\r
@@ -130,8 +134,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                                var entitiesTable = buildTable( selectedEntities );\r
 \r
-                               // Create the Regex used to find entities in the text.\r
-                               var entitiesRegex = '[' + entitiesTable.regex + ']';\r
+                               // Create the Regex used to find entities in the text, leave it matches nothing if entities are empty.\r
+                               var entitiesRegex = entitiesTable.regex ? '[' + entitiesTable.regex + ']' : 'a^';\r
                                delete entitiesTable.regex;\r
 \r
                                if ( config.entities && config.entities_processNumerical )\r
@@ -170,6 +174,22 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 })();\r
 \r
 /**\r
+ * Whether to escape HTML preserved entities in text, including:\r
+ * <ul>\r
+ * <li>nbsp</li>\r
+ * <li>gt</li>\r
+ * <li>lt</li>\r
+ * <li>amp</li>\r
+ * </ul>\r
+ * <strong>Note:</strong> It should not be subjected to change unless you're outputting non-HTML data format like BBCode.\r
+ * @type Boolean\r
+ * @default true\r
+ * @example\r
+ * config.basicEntities = false;\r
+ */\r
+CKEDITOR.config.basicEntities = true;\r
+\r
+/**\r
  * Whether to use HTML entities in the output.\r
  * @name CKEDITOR.config.entities\r
  * @type Boolean\r