annotate media/js/tiny_mce/themes/simple/editor_template_src.js @ 152:bc657962941e

Implement #42; add admin actions to GCalendar.
author Brian Neal <bgneal@gmail.com>
date Sat, 19 Dec 2009 04:59:06 +0000
parents a5b4c5ce0658
children 149c3567fec1
rev   line source
bgneal@45 1 /**
bgneal@45 2 * $Id: editor_template_src.js 920 2008-09-09 14:05:33Z spocke $
bgneal@45 3 *
bgneal@45 4 * This file is meant to showcase how to create a simple theme. The advanced
bgneal@45 5 * theme is more suitable for production use.
bgneal@45 6 *
bgneal@45 7 * @author Moxiecode
bgneal@45 8 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
bgneal@45 9 */
bgneal@45 10
bgneal@45 11 (function() {
bgneal@45 12 var DOM = tinymce.DOM;
bgneal@45 13
bgneal@45 14 // Tell it to load theme specific language pack(s)
bgneal@45 15 tinymce.ThemeManager.requireLangPack('simple');
bgneal@45 16
bgneal@45 17 tinymce.create('tinymce.themes.SimpleTheme', {
bgneal@45 18 init : function(ed, url) {
bgneal@45 19 var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings;
bgneal@45 20
bgneal@45 21 t.editor = ed;
bgneal@45 22
bgneal@45 23 ed.onInit.add(function() {
bgneal@45 24 ed.onNodeChange.add(function(ed, cm) {
bgneal@45 25 tinymce.each(states, function(c) {
bgneal@45 26 cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c));
bgneal@45 27 });
bgneal@45 28 });
bgneal@45 29
bgneal@45 30 ed.dom.loadCSS(url + "/skins/" + s.skin + "/content.css");
bgneal@45 31 });
bgneal@45 32
bgneal@45 33 DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css");
bgneal@45 34 },
bgneal@45 35
bgneal@45 36 renderUI : function(o) {
bgneal@45 37 var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc;
bgneal@45 38
bgneal@45 39 n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n);
bgneal@45 40 n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'});
bgneal@45 41 n = tb = DOM.add(n, 'tbody');
bgneal@45 42
bgneal@45 43 // Create iframe container
bgneal@45 44 n = DOM.add(tb, 'tr');
bgneal@45 45 n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'});
bgneal@45 46
bgneal@45 47 // Create toolbar container
bgneal@45 48 n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'});
bgneal@45 49
bgneal@45 50 // Create toolbar
bgneal@45 51 tb = t.toolbar = cf.createToolbar("tools1");
bgneal@45 52 tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'}));
bgneal@45 53 tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'}));
bgneal@45 54 tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'}));
bgneal@45 55 tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'}));
bgneal@45 56 tb.add(cf.createSeparator());
bgneal@45 57 tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'}));
bgneal@45 58 tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'}));
bgneal@45 59 tb.add(cf.createSeparator());
bgneal@45 60 tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'}));
bgneal@45 61 tb.add(cf.createSeparator());
bgneal@45 62 tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'}));
bgneal@45 63 tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'}));
bgneal@45 64 tb.renderTo(n);
bgneal@45 65
bgneal@45 66 return {
bgneal@45 67 iframeContainer : ic,
bgneal@45 68 editorContainer : ed.id + '_container',
bgneal@45 69 sizeContainer : sc,
bgneal@45 70 deltaHeight : -20
bgneal@45 71 };
bgneal@45 72 },
bgneal@45 73
bgneal@45 74 getInfo : function() {
bgneal@45 75 return {
bgneal@45 76 longname : 'Simple theme',
bgneal@45 77 author : 'Moxiecode Systems AB',
bgneal@45 78 authorurl : 'http://tinymce.moxiecode.com',
bgneal@45 79 version : tinymce.majorVersion + "." + tinymce.minorVersion
bgneal@45 80 }
bgneal@45 81 }
bgneal@45 82 });
bgneal@45 83
bgneal@45 84 tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme);
bgneal@45 85 })();