]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/tiny_mce/plugins/style/editor_plugin_src.js
Release 6.2.0beta4
[Github/sugarcrm.git] / include / javascript / tiny_mce / plugins / style / editor_plugin_src.js
1 /**
2
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 })();