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