nouveau style menu_top
[mtweb] / mw / libs / tiny_mce / plugins / advlink / 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.AdvancedLinkPlugin', {\r
13                 init : function(ed, url) {\r
14                         this.editor = ed;\r
15 \r
16                         // Register commands\r
17                         ed.addCommand('mceAdvLink', function() {\r
18                                 var se = ed.selection;\r
19 \r
20                                 // No selection and not in link\r
21                                 if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A'))\r
22                                         return;\r
23 \r
24                                 ed.windowManager.open({\r
25                                         file : url + '/link.htm',\r
26                                         width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),\r
27                                         height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),\r
28                                         inline : 1\r
29                                 }, {\r
30                                         plugin_url : url\r
31                                 });\r
32                         });\r
33 \r
34                         // Register buttons\r
35                         ed.addButton('link', {\r
36                                 title : 'advlink.link_desc',\r
37                                 cmd : 'mceAdvLink'\r
38                         });\r
39 \r
40                         ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');\r
41 \r
42                         ed.onNodeChange.add(function(ed, cm, n, co) {\r
43                                 cm.setDisabled('link', co && n.nodeName != 'A');\r
44                                 cm.setActive('link', n.nodeName == 'A' && !n.name);\r
45                         });\r
46                 },\r
47 \r
48                 getInfo : function() {\r
49                         return {\r
50                                 longname : 'Advanced link',\r
51                                 author : 'Moxiecode Systems AB',\r
52                                 authorurl : 'http://tinymce.moxiecode.com',\r
53                                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',\r
54                                 version : tinymce.majorVersion + "." + tinymce.minorVersion\r
55                         };\r
56                 }\r
57         });\r
58 \r
59         // Register plugin\r
60         tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);\r
61 })();