Upgrade TinyMCE to v3.4.5
[citadel.git] / webcit / tiny_mce / plugins / legacyoutput / editor_plugin_src.js
index e852da15eac05b5853b267c9066c9f97f39c7c56..e627ec76e4bbc53445834d299dfe31bf6261f5b6 100644 (file)
@@ -26,7 +26,7 @@
                        editor.onInit.add(function() {\r
                                var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',\r
                                        fontSizes = tinymce.explode(editor.settings.font_size_style_values),\r
-                                       serializer = editor.serializer;\r
+                                       schema = editor.schema;\r
 \r
                                // Override some internal formats to produce legacy elements and attributes\r
                                editor.formatter.register({\r
                                        alignleft : {selector : alignElements, attributes : {align : 'left'}},\r
                                        aligncenter : {selector : alignElements, attributes : {align : 'center'}},\r
                                        alignright : {selector : alignElements, attributes : {align : 'right'}},\r
-                                       alignfull : {selector : alignElements, attributes : {align : 'full'}},\r
-\r
-                                       // Change the basic formatting elements to use deprecated element types\r
-                                       bold : {inline : 'b'},\r
-                                       italic : {inline : 'i'},\r
-                                       underline : {inline : 'u'},\r
-                                       strikethrough : {inline : 'strike'},\r
+                                       alignfull : {selector : alignElements, attributes : {align : 'justify'}},\r
+\r
+                                       // Change the basic formatting elements to use deprecated element types
+                                       bold : [\r
+                                               {inline : 'b', remove : 'all'},\r
+                                               {inline : 'strong', remove : 'all'},\r
+                                               {inline : 'span', styles : {fontWeight : 'bold'}}\r
+                                       ],\r
+                                       italic : [\r
+                                               {inline : 'i', remove : 'all'},\r
+                                               {inline : 'em', remove : 'all'},\r
+                                               {inline : 'span', styles : {fontStyle : 'italic'}}\r
+                                       ],\r
+                                       underline : [\r
+                                               {inline : 'u', remove : 'all'},\r
+                                               {inline : 'span', styles : {textDecoration : 'underline'}, exact : true}\r
+                                       ],\r
+                                       strikethrough : [\r
+                                               {inline : 'strike', remove : 'all'},\r
+                                               {inline : 'span', styles : {textDecoration: 'line-through'}, exact : true}\r
+                                       ],
 \r
                                        // Change font size and font family to use the deprecated font element\r
                                        fontname : {inline : 'font', attributes : {face : '%value'}},\r
                                        hilitecolor : {inline : 'font', styles : {backgroundColor : '%value'}}\r
                                });\r
 \r
-                               // Force parsing of the serializer rules\r
-                               serializer._setup();\r
-\r
                                // Check that deprecated elements are allowed if not add them\r
                                tinymce.each('b,i,u,strike'.split(','), function(name) {\r
-                                       var rule = serializer.rules[name];\r
-\r
-                                       if (!rule)\r
-                                               serializer.addRules(name);\r
+                                       schema.addValidElements(name + '[*]');\r
                                });\r
 \r
                                // Add font element if it's missing\r
-                               if (!serializer.rules["font"])\r
-                                       serializer.addRules("font[face|size|color|style]");\r
+                               if (!schema.getElementRule("font"))\r
+                                       schema.addValidElements("font[face|size|color|style]");\r
 \r
                                // Add the missing and depreacted align attribute for the serialization engine\r
                                tinymce.each(alignElements.split(','), function(name) {\r
-                                       var rule = serializer.rules[name], found;\r
+                                       var rule = schema.getElementRule(name), found;\r
 \r
                                        if (rule) {\r
-                                               tinymce.each(rule.attribs, function(name, attr) {\r
-                                                       if (attr.name == 'align') {\r
-                                                               found = true;\r
-                                                               return false;\r
-                                                       }\r
-                                               });\r
-\r
-                                               if (!found)\r
-                                                       rule.attribs.push({name : 'align'});\r
+                                               if (!rule.attributes.align) {\r
+                                                       rule.attributes.align = {};\r
+                                                       rule.attributesOrder.push('align');\r
+                                               }\r
                                        }\r
                                });\r
 \r
 \r
        // Register plugin\r
        tinymce.PluginManager.add('legacyoutput', tinymce.plugins.LegacyOutput);\r
-})(tinymce);
\ No newline at end of file
+})(tinymce);\r