mise a jour pour mtweb.0.9.0
[mw_pages] / app / out / default / tiny_mce / plugins / fullpage / editor_plugin_src.js
diff --git a/app/out/default/tiny_mce/plugins/fullpage/editor_plugin_src.js b/app/out/default/tiny_mce/plugins/fullpage/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..a2c9df8
--- /dev/null
@@ -0,0 +1,153 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.FullPagePlugin', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceFullPageProperties', function() {\r
+                               ed.windowManager.open({\r
+                                       file : url + '/fullpage.htm',\r
+                                       width : 430 + parseInt(ed.getLang('fullpage.delta_width', 0)),\r
+                                       height : 495 + parseInt(ed.getLang('fullpage.delta_height', 0)),\r
+                                       inline : 1\r
+                               }, {\r
+                                       plugin_url : url,\r
+                                       head_html : t.head\r
+                               });\r
+                       });\r
+\r
+                       // Register buttons\r
+                       ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'});\r
+\r
+                       ed.onBeforeSetContent.add(t._setContent, t);\r
+                       ed.onSetContent.add(t._setBodyAttribs, t);\r
+                       ed.onGetContent.add(t._getContent, t);\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Fullpage',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private plugin internal methods\r
+\r
+               _setBodyAttribs : function(ed, o) {\r
+                       var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i);\r
+\r
+                       if (attr && attr[1]) {\r
+                               bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);\r
+\r
+                               if (bdattr) {\r
+                                       for(i = 0, len = bdattr.length; i < len; i++) {\r
+                                               kv = bdattr[i].split('=');\r
+                                               k = kv[0].replace(/\s/,'');\r
+                                               v = kv[1];\r
+\r
+                                               if (v) {\r
+                                                       v = v.replace(/^\s+/,'').replace(/\s+$/,'');\r
+                                                       t = v.match(/^["'](.*)["']$/);\r
+\r
+                                                       if (t)\r
+                                                               v = t[1];\r
+                                               } else\r
+                                                       v = k;\r
+\r
+                                               ed.dom.setAttrib(ed.getBody(), 'style', v);\r
+                                       }\r
+                               }\r
+                       }\r
+               },\r
+\r
+               _createSerializer : function() {\r
+                       return new tinymce.dom.Serializer({\r
+                               dom : this.editor.dom,\r
+                               apply_source_formatting : true\r
+                       });\r
+               },\r
+\r
+               _setContent : function(ed, o) {\r
+                       var t = this, sp, ep, c = o.content, v, st = '';\r
+\r
+                       // Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate\r
+                       if (o.format == 'raw' && t.head)\r
+                               return;\r
+\r
+                       if (o.source_view && ed.getParam('fullpage_hide_in_source_view'))\r
+                               return;\r
+\r
+                       // Parse out head, body and footer\r
+                       c = c.replace(/<(\/?)BODY/gi, '<$1body');\r
+                       sp = c.indexOf('<body');\r
+\r
+                       if (sp != -1) {\r
+                               sp = c.indexOf('>', sp);\r
+                               t.head = c.substring(0, sp + 1);\r
+\r
+                               ep = c.indexOf('</body', sp);\r
+                               if (ep == -1)\r
+                                       ep = c.indexOf('</body', ep);\r
+\r
+                               o.content = c.substring(sp + 1, ep);\r
+                               t.foot = c.substring(ep);\r
+\r
+                               function low(s) {\r
+                                       return s.replace(/<\/?[A-Z]+/g, function(a) {\r
+                                               return a.toLowerCase();\r
+                                       })\r
+                               };\r
+\r
+                               t.head = low(t.head);\r
+                               t.foot = low(t.foot);\r
+                       } else {\r
+                               t.head = '';\r
+                               if (ed.getParam('fullpage_default_xml_pi'))\r
+                                       t.head += '<?xml version="1.0" encoding="' + ed.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';\r
+\r
+                               t.head += ed.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');\r
+                               t.head += '\n<html>\n<head>\n<title>' + ed.getParam('fullpage_default_title', 'Untitled document') + '</title>\n';\r
+\r
+                               if (v = ed.getParam('fullpage_default_encoding'))\r
+                                       t.head += '<meta http-equiv="Content-Type" content="' + v + '" />\n';\r
+\r
+                               if (v = ed.getParam('fullpage_default_font_family'))\r
+                                       st += 'font-family: ' + v + ';';\r
+\r
+                               if (v = ed.getParam('fullpage_default_font_size'))\r
+                                       st += 'font-size: ' + v + ';';\r
+\r
+                               if (v = ed.getParam('fullpage_default_text_color'))\r
+                                       st += 'color: ' + v + ';';\r
+\r
+                               t.head += '</head>\n<body' + (st ? ' style="' + st + '"' : '') + '>\n';\r
+                               t.foot = '\n</body>\n</html>';\r
+                       }\r
+               },\r
+\r
+               _getContent : function(ed, o) {\r
+                       var t = this;\r
+\r
+                       if (!o.source_view || !ed.getParam('fullpage_hide_in_source_view'))\r
+                               o.content = tinymce.trim(t.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(t.foot);\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin);\r
+})();
\ No newline at end of file