nouveau style menu_top
[mtweb] / mw / libs / tiny_mce / plugins / style / editor_plugin_src.js
1 /**\r
2  * editor_plugin_src.js\r
3  *\r
4  * Copyright 2009, Moxiecode Systems AB\r
5  * Released under LGPL License.\r
6  *\r
7  * License: http://tinymce.moxiecode.com/license\r
8  * Contributing: http://tinymce.moxiecode.com/contributing\r
9  */\r
10 \r
11 (function() {\r
12         tinymce.create('tinymce.plugins.StylePlugin', {\r
13                 init : function(ed, url) {\r
14                         // Register commands\r
15                         ed.addCommand('mceStyleProps', function() {\r
16                                 ed.windowManager.open({\r
17                                         file : url + '/props.htm',\r
18                                         width : 480 + parseInt(ed.getLang('style.delta_width', 0)),\r
19                                         height : 320 + parseInt(ed.getLang('style.delta_height', 0)),\r
20                                         inline : 1\r
21                                 }, {\r
22                                         plugin_url : url,\r
23                                         style_text : ed.selection.getNode().style.cssText\r
24                                 });\r
25                         });\r
26 \r
27                         ed.addCommand('mceSetElementStyle', function(ui, v) {\r
28                                 if (e = ed.selection.getNode()) {\r
29                                         ed.dom.setAttrib(e, 'style', v);\r
30                                         ed.execCommand('mceRepaint');\r
31                                 }\r
32                         });\r
33 \r
34                         ed.onNodeChange.add(function(ed, cm, n) {\r
35                                 cm.setDisabled('styleprops', n.nodeName === 'BODY');\r
36                         });\r
37 \r
38                         // Register buttons\r
39                         ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});\r
40                 },\r
41 \r
42                 getInfo : function() {\r
43                         return {\r
44                                 longname : 'Style',\r
45                                 author : 'Moxiecode Systems AB',\r
46                                 authorurl : 'http://tinymce.moxiecode.com',\r
47                                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',\r
48                                 version : tinymce.majorVersion + "." + tinymce.minorVersion\r
49                         };\r
50                 }\r
51         });\r
52 \r
53         // Register plugin\r
54         tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);\r
55 })();