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