Upgrade TinyMCE to v3.4.5
[citadel.git] / webcit / tiny_mce / themes / simple / editor_template_src.js
index 66eca18e2ab57e404ca8be6ec2faf3354aadc099..01ce87c58a9e25eb6cb8b3a0d331e8416099c5ee 100644 (file)
@@ -1,70 +1,84 @@
-function TinyMCE_simple_getEditorTemplate() {\r
-       var template = new Array();\r
+/**\r
+ * editor_template_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
-       template['html'] = '\\r
-<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}">\\r
-<tr><td align="center">\\r
-<span id="{$editor_id}">IFRAME</span>\\r
-</td></tr>\\r
-<tr><td class="mceToolbar" align="center" height="1">\\r
-<a href="javascript:void(0);" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\');" onmousedown="return false;"><img id="{$editor_id}_bold" src="{$themeurl}/images/{$lang_bold_img}" title="{$lang_bold_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');"></a>\\r
-<a href="javascript:void(0);" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Italic\');" onmousedown="return false;"><img id="{$editor_id}_italic" src="{$themeurl}/images/{$lang_italic_img}" title="{$lang_italic_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');">\\r
-<a href="javascript:void(0);" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Underline\');" onmousedown="return false;"><img id="{$editor_id}_underline" src="{$themeurl}/images/{$lang_underline_img}" title="{$lang_underline_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');">\\r
-<a href="javascript:void(0);" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\');" onmousedown="return false;"><img id="{$editor_id}_strikethrough" src="{$themeurl}/images/strikethrough.gif" title="{$lang_striketrough_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');">\\r
-<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">\\r
-<a href="javascript:void(0);" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\');" onmousedown="return false;"><img src="{$themeurl}/images/undo.gif" title="{$lang_undo_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');">\\r
-<a href="javascript:void(0);" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\');" onmousedown="return false;"><img src="{$themeurl}/images/redo.gif" title="{$lang_redo_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');">\\r
-<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">\\r
-<a href="javascript:void(0);" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCleanup\');" onmousedown="return false;"><img src="{$themeurl}/images/cleanup.gif" title="{$lang_cleanup_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');">\\r
-<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">\\r
-<a href="javascript:void(0);" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\');" onmousedown="return false;"><img id="{$editor_id}_bullist" src="{$themeurl}/images/bullist.gif" title="{$lang_bullist_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');">\\r
-<a href="javascript:void(0);" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\');" onmousedown="return false;"><img id="{$editor_id}_numlist" src="{$themeurl}/images/numlist.gif" title="{$lang_numlist_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');">\\r
-</td></tr>\\r
-</table>';\r
+(function() {\r
+       var DOM = tinymce.DOM;\r
 \r
-       template['delta_width'] = 0;\r
-       template['delta_height'] = -20;\r
+       // Tell it to load theme specific language pack(s)\r
+       tinymce.ThemeManager.requireLangPack('simple');\r
 \r
-       return template;\r
-}\r
+       tinymce.create('tinymce.themes.SimpleTheme', {\r
+               init : function(ed, url) {\r
+                       var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings;\r
 \r
-function TinyMCE_simple_handleNodeChange(editor_id, node) {\r
-       // Reset old states\r
-       tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonNormal');\r
-       tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonNormal');\r
-       tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonNormal');\r
-       tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonNormal');\r
-       tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonNormal');\r
-       tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonNormal');\r
+                       t.editor = ed;\r
+                       ed.contentCSS.push(url + "/skins/" + s.skin + "/content.css");\r
 \r
-       // Handle elements\r
-       do {\r
-               switch (node.nodeName.toLowerCase()) {\r
-                       case "b":\r
-                       case "strong":\r
-                               tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');\r
-                       break;\r
+                       ed.onInit.add(function() {\r
+                               ed.onNodeChange.add(function(ed, cm) {\r
+                                       tinymce.each(states, function(c) {\r
+                                               cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c));\r
+                                       });\r
+                               });\r
+                       });\r
 \r
-                       case "i":\r
-                       case "em":\r
-                               tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');\r
-                       break;\r
+                       DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css");\r
+               },\r
 \r
-                       case "u":\r
-                               tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');\r
-                       break;\r
+               renderUI : function(o) {\r
+                       var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc;\r
 \r
-                       case "strike":\r
-                               tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');\r
-                       break;\r
-                       \r
-                       case "ul":\r
-                               tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonSelected');\r
-                       break;\r
+                       n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n);\r
+                       n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'});\r
+                       n = tb = DOM.add(n, 'tbody');\r
 \r
-                       case "ol":\r
-                               tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonSelected');\r
-                       break;\r
+                       // Create iframe container\r
+                       n = DOM.add(tb, 'tr');\r
+                       n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'});\r
+\r
+                       // Create toolbar container\r
+                       n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'});\r
+\r
+                       // Create toolbar\r
+                       tb = t.toolbar = cf.createToolbar("tools1");\r
+                       tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'}));\r
+                       tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'}));\r
+                       tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'}));\r
+                       tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'}));\r
+                       tb.add(cf.createSeparator());\r
+                       tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'}));\r
+                       tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'}));\r
+                       tb.add(cf.createSeparator());\r
+                       tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'}));\r
+                       tb.add(cf.createSeparator());\r
+                       tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'}));\r
+                       tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'}));\r
+                       tb.renderTo(n);\r
+\r
+                       return {\r
+                               iframeContainer : ic,\r
+                               editorContainer : ed.id + '_container',\r
+                               sizeContainer : sc,\r
+                               deltaHeight : -20\r
+                       };\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Simple theme',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       }\r
                }\r
-       } while ((node = node.parentNode) != null);\r
-}\r
+       });\r
+\r
+       tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme);\r
+})();
\ No newline at end of file