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