2 * $Id: editor_template_src.js 752 2008-03-27 21:51:25Z spocke $
\r
4 * This file is meant to showcase how to create a simple theme. The advanced
\r
5 * theme is more suitable for production use.
\r
8 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
\r
12 var DOM = tinymce.DOM;
\r
14 // Tell it to load theme specific language pack(s)
\r
15 tinymce.ThemeManager.requireLangPack('simple');
\r
17 tinymce.create('tinymce.themes.SimpleTheme', {
\r
18 init : function(ed, url) {
\r
19 var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings;
\r
23 ed.onInit.add(function() {
\r
24 ed.onNodeChange.add(function(ed, cm) {
\r
25 tinymce.each(states, function(c) {
\r
26 cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c));
\r
30 ed.dom.loadCSS(url + "/skins/" + s.skin + "/content.css");
\r
33 DOM.loadCSS((s.editor_css ? ed.baseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css");
\r
36 renderUI : function(o) {
\r
37 var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc;
\r
39 n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n);
\r
40 n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'});
\r
41 n = tb = DOM.add(n, 'tbody');
\r
43 // Create iframe container
\r
44 n = DOM.add(tb, 'tr');
\r
45 n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'});
\r
47 // Create toolbar container
\r
48 n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'});
\r
51 tb = t.toolbar = cf.createToolbar("tools1");
\r
52 tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'}));
\r
53 tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'}));
\r
54 tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'}));
\r
55 tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'}));
\r
56 tb.add(cf.createSeparator());
\r
57 tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'}));
\r
58 tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'}));
\r
59 tb.add(cf.createSeparator());
\r
60 tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'}));
\r
61 tb.add(cf.createSeparator());
\r
62 tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'}));
\r
63 tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'}));
\r
67 iframeContainer : ic,
\r
68 editorContainer : ed.id + '_container',
\r
74 getInfo : function() {
\r
76 longname : 'Simple theme',
\r
77 author : 'Moxiecode Systems AB',
\r
78 authorurl : 'http://tinymce.moxiecode.com',
\r
79 version : tinymce.majorVersion + "." + tinymce.minorVersion
\r
84 tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme);
\r