nouveau style menu_top
[mtweb] / mw / libs / tiny_mce / plugins / xhtmlxtras / 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.XHTMLXtrasPlugin', {\r
13                 init : function(ed, url) {\r
14                         // Register commands\r
15                         ed.addCommand('mceCite', function() {\r
16                                 ed.windowManager.open({\r
17                                         file : url + '/cite.htm',\r
18                                         width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),\r
19                                         height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),\r
20                                         inline : 1\r
21                                 }, {\r
22                                         plugin_url : url\r
23                                 });\r
24                         });\r
25 \r
26                         ed.addCommand('mceAcronym', function() {\r
27                                 ed.windowManager.open({\r
28                                         file : url + '/acronym.htm',\r
29                                         width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),\r
30                                         height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),\r
31                                         inline : 1\r
32                                 }, {\r
33                                         plugin_url : url\r
34                                 });\r
35                         });\r
36 \r
37                         ed.addCommand('mceAbbr', function() {\r
38                                 ed.windowManager.open({\r
39                                         file : url + '/abbr.htm',\r
40                                         width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),\r
41                                         height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),\r
42                                         inline : 1\r
43                                 }, {\r
44                                         plugin_url : url\r
45                                 });\r
46                         });\r
47 \r
48                         ed.addCommand('mceDel', function() {\r
49                                 ed.windowManager.open({\r
50                                         file : url + '/del.htm',\r
51                                         width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),\r
52                                         height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),\r
53                                         inline : 1\r
54                                 }, {\r
55                                         plugin_url : url\r
56                                 });\r
57                         });\r
58 \r
59                         ed.addCommand('mceIns', function() {\r
60                                 ed.windowManager.open({\r
61                                         file : url + '/ins.htm',\r
62                                         width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),\r
63                                         height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),\r
64                                         inline : 1\r
65                                 }, {\r
66                                         plugin_url : url\r
67                                 });\r
68                         });\r
69 \r
70                         ed.addCommand('mceAttributes', function() {\r
71                                 ed.windowManager.open({\r
72                                         file : url + '/attributes.htm',\r
73                                         width : 380,\r
74                                         height : 370,\r
75                                         inline : 1\r
76                                 }, {\r
77                                         plugin_url : url\r
78                                 });\r
79                         });\r
80 \r
81                         // Register buttons\r
82                         ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});\r
83                         ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});\r
84                         ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});\r
85                         ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});\r
86                         ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});\r
87                         ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});\r
88 \r
89                         ed.onNodeChange.add(function(ed, cm, n, co) {\r
90                                 n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');\r
91 \r
92                                 cm.setDisabled('cite', co);\r
93                                 cm.setDisabled('acronym', co);\r
94                                 cm.setDisabled('abbr', co);\r
95                                 cm.setDisabled('del', co);\r
96                                 cm.setDisabled('ins', co);\r
97                                 cm.setDisabled('attribs', n && n.nodeName == 'BODY');\r
98                                 cm.setActive('cite', 0);\r
99                                 cm.setActive('acronym', 0);\r
100                                 cm.setActive('abbr', 0);\r
101                                 cm.setActive('del', 0);\r
102                                 cm.setActive('ins', 0);\r
103 \r
104                                 // Activate all\r
105                                 if (n) {\r
106                                         do {\r
107                                                 cm.setDisabled(n.nodeName.toLowerCase(), 0);\r
108                                                 cm.setActive(n.nodeName.toLowerCase(), 1);\r
109                                         } while (n = n.parentNode);\r
110                                 }\r
111                         });\r
112 \r
113                         ed.onPreInit.add(function() {\r
114                                 // Fixed IE issue where it can't handle these elements correctly\r
115                                 ed.dom.create('abbr');\r
116                         });\r
117                 },\r
118 \r
119                 getInfo : function() {\r
120                         return {\r
121                                 longname : 'XHTML Xtras Plugin',\r
122                                 author : 'Moxiecode Systems AB',\r
123                                 authorurl : 'http://tinymce.moxiecode.com',\r
124                                 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',\r
125                                 version : tinymce.majorVersion + "." + tinymce.minorVersion\r
126                         };\r
127                 }\r
128         });\r
129 \r
130         // Register plugin\r
131         tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);\r
132 })();