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