Upgrade TinyMCE to v3.4.5
[citadel.git] / webcit / tiny_mce / themes / simple / editor_template_src.js
index 437477dfb6d4438d471943cf967f04a661e98bb7..01ce87c58a9e25eb6cb8b3a0d331e8416099c5ee 100644 (file)
@@ -1,70 +1,84 @@
-function TinyMCE_simple_getEditorTemplate() {
-       var template = new Array();
-
-       template['html'] = '\
-<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}">\
-<tr><td align="center">\
-<span id="{$editor_id}">IFRAME</span>\
-</td></tr>\
-<tr><td class="mceToolbar" align="center" height="1">\
-<a href="javascript: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>\
-<a href="javascript: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\');">\
-<a href="javascript: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\');">\
-<a href="javascript: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\');">\
-<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">\
-<a href="javascript: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\');">\
-<a href="javascript: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\');">\
-<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">\
-<a href="javascript: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\');">\
-<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">\
-<a href="javascript: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\');">\
-<a href="javascript: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\');">\
-</td></tr>\
-</table>';
-
-       template['delta_width'] = 0;
-       template['delta_height'] = -20;
-
-       return template;
-}
-
-function TinyMCE_simple_handleNodeChange(editor_id, node) {
-       // Reset old states
-       tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonNormal');
-       tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonNormal');
-       tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonNormal');
-       tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonNormal');
-       tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonNormal');
-       tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonNormal');
-
-       // Handle elements
-       do {
-               switch (node.nodeName.toLowerCase()) {
-                       case "b":
-                       case "strong":
-                               tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
-                       break;
-
-                       case "i":
-                       case "em":
-                               tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
-                       break;
-
-                       case "u":
-                               tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
-                       break;
-
-                       case "strike":
-                               tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
-                       break;
-                       
-                       case "ul":
-                               tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonSelected');
-                       break;
-
-                       case "ol":
-                               tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonSelected');
-                       break;
-               }
-       } while ((node = node.parentNode));
-}
+/**\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
+(function() {\r
+       var DOM = tinymce.DOM;\r
+\r
+       // Tell it to load theme specific language pack(s)\r
+       tinymce.ThemeManager.requireLangPack('simple');\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
+                       t.editor = ed;\r
+                       ed.contentCSS.push(url + "/skins/" + s.skin + "/content.css");\r
+\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
+                       DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css");\r
+               },\r
+\r
+               renderUI : function(o) {\r
+                       var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc;\r
+\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
+                       // 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
+       });\r
+\r
+       tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme);\r
+})();
\ No newline at end of file