bgneal@45: /** bgneal@45: * $Id: editor_template_src.js 920 2008-09-09 14:05:33Z spocke $ bgneal@45: * bgneal@45: * This file is meant to showcase how to create a simple theme. The advanced bgneal@45: * theme is more suitable for production use. bgneal@45: * bgneal@45: * @author Moxiecode bgneal@45: * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. bgneal@45: */ bgneal@45: bgneal@45: (function() { bgneal@45: var DOM = tinymce.DOM; bgneal@45: bgneal@45: // Tell it to load theme specific language pack(s) bgneal@45: tinymce.ThemeManager.requireLangPack('simple'); bgneal@45: bgneal@45: tinymce.create('tinymce.themes.SimpleTheme', { bgneal@45: init : function(ed, url) { bgneal@45: var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings; bgneal@45: bgneal@45: t.editor = ed; bgneal@45: bgneal@45: ed.onInit.add(function() { bgneal@45: ed.onNodeChange.add(function(ed, cm) { bgneal@45: tinymce.each(states, function(c) { bgneal@45: cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c)); bgneal@45: }); bgneal@45: }); bgneal@45: bgneal@45: ed.dom.loadCSS(url + "/skins/" + s.skin + "/content.css"); bgneal@45: }); bgneal@45: bgneal@45: DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css"); bgneal@45: }, bgneal@45: bgneal@45: renderUI : function(o) { bgneal@45: var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc; bgneal@45: bgneal@45: n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n); bgneal@45: n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'}); bgneal@45: n = tb = DOM.add(n, 'tbody'); bgneal@45: bgneal@45: // Create iframe container bgneal@45: n = DOM.add(tb, 'tr'); bgneal@45: n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'}); bgneal@45: bgneal@45: // Create toolbar container bgneal@45: n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'}); bgneal@45: bgneal@45: // Create toolbar bgneal@45: tb = t.toolbar = cf.createToolbar("tools1"); bgneal@45: tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'})); bgneal@45: tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'})); bgneal@45: tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'})); bgneal@45: tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'})); bgneal@45: tb.add(cf.createSeparator()); bgneal@45: tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'})); bgneal@45: tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'})); bgneal@45: tb.add(cf.createSeparator()); bgneal@45: tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'})); bgneal@45: tb.add(cf.createSeparator()); bgneal@45: tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'})); bgneal@45: tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'})); bgneal@45: tb.renderTo(n); bgneal@45: bgneal@45: return { bgneal@45: iframeContainer : ic, bgneal@45: editorContainer : ed.id + '_container', bgneal@45: sizeContainer : sc, bgneal@45: deltaHeight : -20 bgneal@45: }; bgneal@45: }, bgneal@45: bgneal@45: getInfo : function() { bgneal@45: return { bgneal@45: longname : 'Simple theme', bgneal@45: author : 'Moxiecode Systems AB', bgneal@45: authorurl : 'http://tinymce.moxiecode.com', bgneal@45: version : tinymce.majorVersion + "." + tinymce.minorVersion bgneal@45: } bgneal@45: } bgneal@45: }); bgneal@45: bgneal@45: tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme); bgneal@45: })();