diff -r c72b545f1304 -r 67bd3121a12e includes/clientside/tinymce/themes/simple/editor_template_src.js --- a/includes/clientside/tinymce/themes/simple/editor_template_src.js Wed Dec 26 00:37:26 2007 -0500 +++ b/includes/clientside/tinymce/themes/simple/editor_template_src.js Thu Dec 27 22:09:33 2007 -0500 @@ -1,84 +1,85 @@ /** - * $Id: editor_template_src.js 162 2007-01-03 16:16:52Z spocke $ + * $Id: editor_template_src.js 382 2007-11-13 14:48:38Z spocke $ + * + * This file is meant to showcase how to create a simple theme. The advanced + * theme is more suitable for production use. * * @author Moxiecode * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. */ -var TinyMCE_SimpleTheme = { - // List of button ids in tile map - _buttonMap : 'bold,bullist,cleanup,italic,numlist,redo,strikethrough,underline,undo', +(function() { + var DOM = tinymce.DOM; + + // Tell it to load theme specific language pack(s) + tinymce.ThemeManager.requireLangPack('simple'); - getEditorTemplate : function() { - var html = ''; + tinymce.create('tinymce.themes.SimpleTheme', { + init : function(ed, url) { + var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings; + + t.editor = ed; - html += ''; - html += ''; - html += '
'; - html += 'IFRAME'; - html += '
'; - html += tinyMCE.getButtonHTML('bold', 'lang_bold_desc', '{$themeurl}/images/{$lang_bold_img}', 'Bold'); - html += tinyMCE.getButtonHTML('italic', 'lang_italic_desc', '{$themeurl}/images/{$lang_italic_img}', 'Italic'); - html += tinyMCE.getButtonHTML('underline', 'lang_underline_desc', '{$themeurl}/images/{$lang_underline_img}', 'Underline'); - html += tinyMCE.getButtonHTML('strikethrough', 'lang_striketrough_desc', '{$themeurl}/images/strikethrough.gif', 'Strikethrough'); - html += ''; - html += tinyMCE.getButtonHTML('undo', 'lang_undo_desc', '{$themeurl}/images/undo.gif', 'Undo'); - html += tinyMCE.getButtonHTML('redo', 'lang_redo_desc', '{$themeurl}/images/redo.gif', 'Redo'); - html += ''; - html += tinyMCE.getButtonHTML('cleanup', 'lang_cleanup_desc', '{$themeurl}/images/cleanup.gif', 'mceCleanup'); - html += ''; - html += tinyMCE.getButtonHTML('bullist', 'lang_bullist_desc', '{$themeurl}/images/bullist.gif', 'InsertUnorderedList'); - html += tinyMCE.getButtonHTML('numlist', 'lang_numlist_desc', '{$themeurl}/images/numlist.gif', 'InsertOrderedList'); - html += '
'; + ed.onInit.add(function() { + ed.onNodeChange.add(function(ed, cm) { + tinymce.each(states, function(c) { + cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c)); + }); + }); + + ed.dom.loadCSS(url + "/skins/" + s.skin + "/content.css"); + }); - return { - delta_width : 0, - delta_height : 20, - html : html - }; - }, + DOM.loadCSS(url + "/skins/" + s.skin + "/ui.css"); + }, + + renderUI : function(o) { + var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc; + + n = DOM.insertAfter(DOM.create('div', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin'}), n); + n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'}); + n = tb = DOM.add(n, 'tbody'); + + // Create iframe container + n = DOM.add(tb, 'tr'); + n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'}); - handleNodeChange : function(editor_id, node) { - // Reset old states - tinyMCE.switchClass(editor_id + '_bold', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_italic', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_underline', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonNormal'); - tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonNormal'); + // Create toolbar container + n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar last', align : 'center'}); - // Handle elements - do { - switch (node.nodeName.toLowerCase()) { - case "b": - case "strong": - tinyMCE.switchClass(editor_id + '_bold', 'mceButtonSelected'); - break; - - case "i": - case "em": - tinyMCE.switchClass(editor_id + '_italic', 'mceButtonSelected'); - break; + // Create toolbar + tb = t.toolbar = cf.createToolbar("tools1"); + tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'})); + tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'})); + tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'})); + tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'})); + tb.add(cf.createSeparator()); + tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'})); + tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'})); + tb.add(cf.createSeparator()); + tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'})); + tb.add(cf.createSeparator()); + tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'})); + tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'})); + tb.renderTo(n); - case "u": - tinyMCE.switchClass(editor_id + '_underline', 'mceButtonSelected'); - break; + return { + iframeContainer : ic, + editorContainer : ed.id + '_container', + sizeContainer : sc, + deltaHeight : -20 + }; + }, - case "strike": - tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonSelected'); - break; - - case "ul": - tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonSelected'); - break; + getInfo : function() { + return { + longname : 'Simple theme', + author : 'Moxiecode Systems AB', + authorurl : 'http://tinymce.moxiecode.com', + version : tinymce.majorVersion + "." + tinymce.minorVersion + } + } + }); - case "ol": - tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonSelected'); - break; - } - } while ((node = node.parentNode) != null); - } -}; - -tinyMCE.addTheme("simple", TinyMCE_SimpleTheme); -tinyMCE.addButtonMap(TinyMCE_SimpleTheme._buttonMap); + tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme); +})(); \ No newline at end of file