PageRenderTime 46ms CodeModel.GetById 39ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/static/scripts/tiny_mce/plugins/style/editor_plugin_src.js

http://n23.googlecode.com/
JavaScript | 52 lines | 37 code | 6 blank | 9 comment | 1 complexity | d95bd8888758328f31a8670186e65aa1 MD5 | raw file
 1/**
 2 * $Id: editor_plugin_src.js 787 2008-04-10 11:40:57Z spocke $
 3 *
 4 * @author Moxiecode
 5 * @copyright Copyright Š 2004-2008, Moxiecode Systems AB, All rights reserved.
 6 */
 7
 8(function() {
 9	tinymce.create('tinymce.plugins.StylePlugin', {
10		init : function(ed, url) {
11			// Register commands
12			ed.addCommand('mceStyleProps', function() {
13				ed.windowManager.open({
14					file : url + '/props.htm',
15					width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
16					height : 320 + parseInt(ed.getLang('style.delta_height', 0)),
17					inline : 1
18				}, {
19					plugin_url : url,
20					style_text : ed.selection.getNode().style.cssText
21				});
22			});
23
24			ed.addCommand('mceSetElementStyle', function(ui, v) {
25				if (e = ed.selection.getNode()) {
26					ed.dom.setAttrib(e, 'style', v);
27					ed.execCommand('mceRepaint');
28				}
29			});
30
31			ed.onNodeChange.add(function(ed, cm, n) {
32				cm.setDisabled('styleprops', n.nodeName === 'BODY');
33			});
34
35			// Register buttons
36			ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
37		},
38
39		getInfo : function() {
40			return {
41				longname : 'Style',
42				author : 'Moxiecode Systems AB',
43				authorurl : 'http://tinymce.moxiecode.com',
44				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
45				version : tinymce.majorVersion + "." + tinymce.minorVersion
46			};
47		}
48	});
49
50	// Register plugin
51	tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
52})();