]> git.mxchange.org Git - friendica.git/blob - library/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin_src.js
eaa7c7713adaf4a1f85c620c00cbafc10e85fd6e
[friendica.git] / library / tinymce / jscripts / 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 \r
17                                 var applyStyleToBlocks = false;\r
18                                 var blocks = ed.selection.getSelectedBlocks();\r
19                                 var styles = [];\r
20 \r
21                                 if (blocks.length === 1) {\r
22                                         styles.push(ed.selection.getNode().style.cssText);\r
23                                 }\r
24                                 else {\r
25                                         tinymce.each(blocks, function(block) {\r
26                                                 styles.push(ed.dom.getAttrib(block, 'style'));\r
27                                         });\r
28                                         applyStyleToBlocks = true;\r
29                                 }\r
30 \r
31                                 ed.windowManager.open({\r
32                                         file : url + '/props.htm',\r
33                                         width : 480 + parseInt(ed.getLang('style.delta_width', 0)),\r
34                                         height : 340 + parseInt(ed.getLang('style.delta_height', 0)),\r
35                                         inline : 1\r
36                                 }, {\r
37                                         applyStyleToBlocks : applyStyleToBlocks,\r
38                                         plugin_url : url,\r
39                                         styles : styles\r
40                                 });\r
41                         });\r
42 \r
43                         ed.addCommand('mceSetElementStyle', function(ui, v) {\r
44                                 if (e = ed.selection.getNode()) {\r
45                                         ed.dom.setAttrib(e, 'style', v);\r
46                                         ed.execCommand('mceRepaint');\r
47                                 }\r
48                         });\r
49 \r
50                         ed.onNodeChange.add(function(ed, cm, n) {\r
51                                 cm.setDisabled('styleprops', n.nodeName === 'BODY');\r
52                         });\r
53 \r
54                         // Register buttons\r
55                         ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});\r
56                 },\r
57 \r
58                 getInfo : function() {\r
59                         return {\r
60                                 longname : 'Style',\r
61                                 author : 'Moxiecode Systems AB',\r
62                                 authorurl : 'http://tinymce.moxiecode.com',\r
63                                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',\r
64                                 version : tinymce.majorVersion + "." + tinymce.minorVersion\r
65                         };\r
66                 }\r
67         });\r
68 \r
69         // Register plugin\r
70         tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);\r
71 })();\r