]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/tiny_mce/plugins/style/editor_plugin_src.js
Release 6.5.0
[Github/sugarcrm.git] / include / javascript / tiny_mce / plugins / style / editor_plugin_src.js
1 /**
2  * editor_plugin_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         tinymce.create('tinymce.plugins.StylePlugin', {
13                 init : function(ed, url) {
14                         // Register commands
15                         ed.addCommand('mceStyleProps', function() {
16                                 ed.windowManager.open({
17                                         file : url + '/props.htm',
18                                         width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
19                                         height : 320 + parseInt(ed.getLang('style.delta_height', 0)),
20                                         inline : 1
21                                 }, {
22                                         plugin_url : url,
23                                         style_text : ed.selection.getNode().style.cssText
24                                 });
25                         });
26
27                         ed.addCommand('mceSetElementStyle', function(ui, v) {
28                                 if (e = ed.selection.getNode()) {
29                                         ed.dom.setAttrib(e, 'style', v);
30                                         ed.execCommand('mceRepaint');
31                                 }
32                         });
33
34                         ed.onNodeChange.add(function(ed, cm, n) {
35                                 cm.setDisabled('styleprops', n.nodeName === 'BODY');
36                         });
37
38                         // Register buttons
39                         ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
40                 },
41
42                 getInfo : function() {
43                         return {
44                                 longname : 'Style',
45                                 author : 'Moxiecode Systems AB',
46                                 authorurl : 'http://tinymce.moxiecode.com',
47                                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
48                                 version : tinymce.majorVersion + "." + tinymce.minorVersion
49                         };
50                 }
51         });
52
53         // Register plugin
54         tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
55 })();