PageRenderTime 54ms CodeModel.GetById 41ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/editors/tiny_mce_3_4_3_1/themes/simple/editor_template_src.js

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