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