-/* Import plugin specific language pack */\r
-tinyMCE.importPluginLanguagePack('xhtmlxtras');\r
-\r
-var TinyMCE_XHTMLXtrasPlugin = {\r
- getInfo : function() {\r
- return {\r
- longname : 'XHTML Xtras Plugin',\r
- author : 'Moxiecode Systems AB',\r
- authorurl : 'http://tinymce.moxiecode.com',\r
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',\r
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion\r
- };\r
- },\r
-\r
- initInstance : function(inst) {\r
- tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/xhtmlxtras/css/xhtmlxtras.css");\r
- },\r
-\r
- getControlHTML : function(cn) {\r
- switch (cn) {\r
- case "cite":\r
- return tinyMCE.getButtonHTML(cn, 'lang_xhtmlxtras_cite_desc', '{$pluginurl}/images/cite.gif', 'mceCite', true);\r
-\r
- case "acronym":\r
- return tinyMCE.getButtonHTML(cn, 'lang_xhtmlxtras_acronym_desc', '{$pluginurl}/images/acronym.gif', 'mceAcronym', true);\r
-\r
- case "abbr":\r
- return tinyMCE.getButtonHTML(cn, 'lang_xhtmlxtras_abbr_desc', '{$pluginurl}/images/abbr.gif', 'mceAbbr', true);\r
-\r
- case "del":\r
- return tinyMCE.getButtonHTML(cn, 'lang_xhtmlxtras_del_desc', '{$pluginurl}/images/del.gif', 'mceDel', true);\r
-\r
- case "ins":\r
- return tinyMCE.getButtonHTML(cn, 'lang_xhtmlxtras_ins_desc', '{$pluginurl}/images/ins.gif', 'mceIns', true);\r
-\r
- case "attribs":\r
- return tinyMCE.getButtonHTML(cn, 'lang_xhtmlxtras_attribs_desc', '{$pluginurl}/images/attribs.gif', 'mceAttributes', true);\r
- }\r
-\r
- return "";\r
- },\r
-\r
- execCommand : function(editor_id, element, command, user_interface, value) {\r
- var template, inst, elm;\r
-\r
- switch (command) {\r
- case "mceCite":\r
- if (!this._anySel(editor_id))\r
- return true;\r
-\r
- template = new Array();\r
- template['file'] = '../../plugins/xhtmlxtras/cite.htm';\r
- template['width'] = 350;\r
- template['height'] = 250;\r
- tinyMCE.openWindow(template, {editor_id : editor_id});\r
- return true;\r
-\r
- case "mceAcronym":\r
- if (!this._anySel(editor_id))\r
- return true;\r
-\r
- template = new Array();\r
- template['file'] = '../../plugins/xhtmlxtras/acronym.htm';\r
- template['width'] = 350;\r
- template['height'] = 250;\r
- tinyMCE.openWindow(template, {editor_id : editor_id});\r
- return true;\r
-\r
- case "mceAbbr":\r
- if (!this._anySel(editor_id))\r
- return true;\r
-\r
- template = new Array();\r
- template['file'] = '../../plugins/xhtmlxtras/abbr.htm';\r
- template['width'] = 350;\r
- template['height'] = 250;\r
- tinyMCE.openWindow(template, {editor_id : editor_id});\r
- return true;\r
-\r
- case "mceIns":\r
- if (!this._anySel(editor_id))\r
- return true;\r
-\r
- template = new Array();\r
- template['file'] = '../../plugins/xhtmlxtras/ins.htm';\r
- template['width'] = 350;\r
- template['height'] = 310;\r
- tinyMCE.openWindow(template, {editor_id : editor_id});\r
- return true;\r
-\r
- case "mceDel":\r
- if (!this._anySel(editor_id))\r
- return true;\r
-\r
- template = new Array();\r
- template['file'] = '../../plugins/xhtmlxtras/del.htm';\r
- template['width'] = 350;\r
- template['height'] = 310;\r
- tinyMCE.openWindow(template, {editor_id : editor_id});\r
- return true;\r
-\r
- case "mceAttributes":\r
- inst = tinyMCE.getInstanceById(editor_id);\r
- elm = inst.getFocusElement();\r
-\r
- if (elm && elm.nodeName !== 'BODY' && elm.className.indexOf('mceItem') == -1) {\r
- tinyMCE.openWindow({\r
- file : '../../plugins/xhtmlxtras/attributes.htm',\r
- width : 380,\r
- height : 370\r
- }, {editor_id : editor_id});\r
+(function() {\r
+ tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', {\r
+ init : function(ed, url) {\r
+ // Register commands\r
+ ed.addCommand('mceCite', function() {\r
+ ed.windowManager.open({\r
+ file : url + '/cite.htm',\r
+ width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),\r
+ height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),\r
+ inline : 1\r
+ }, {\r
+ plugin_url : url\r
+ });\r
+ });\r
+\r
+ ed.addCommand('mceAcronym', function() {\r
+ ed.windowManager.open({\r
+ file : url + '/acronym.htm',\r
+ width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),\r
+ height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_height', 0)),\r
+ inline : 1\r
+ }, {\r
+ plugin_url : url\r
+ });\r
+ });\r
+\r
+ ed.addCommand('mceAbbr', function() {\r
+ ed.windowManager.open({\r
+ file : url + '/abbr.htm',\r
+ width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),\r
+ height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_height', 0)),\r
+ inline : 1\r
+ }, {\r
+ plugin_url : url\r
+ });\r
+ });\r
+\r
+ ed.addCommand('mceDel', function() {\r
+ ed.windowManager.open({\r
+ file : url + '/del.htm',\r
+ width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),\r
+ height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_height', 0)),\r
+ inline : 1\r
+ }, {\r
+ plugin_url : url\r
+ });\r
+ });\r
+\r
+ ed.addCommand('mceIns', function() {\r
+ ed.windowManager.open({\r
+ file : url + '/ins.htm',\r
+ width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),\r
+ height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_height', 0)),\r
+ inline : 1\r
+ }, {\r
+ plugin_url : url\r
+ });\r
+ });\r
+\r
+ ed.addCommand('mceAttributes', function() {\r
+ ed.windowManager.open({\r
+ file : url + '/attributes.htm',\r
+ width : 380 + parseInt(ed.getLang('xhtmlxtras.attr_delta_width', 0)),\r
+ height : 370 + parseInt(ed.getLang('xhtmlxtras.attr_delta_height', 0)),\r
+ inline : 1\r
+ }, {\r
+ plugin_url : url\r
+ });\r
+ });\r
+\r
+ // Register buttons\r
+ ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});\r
+ ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});\r
+ ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});\r
+ ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});\r
+ ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});\r
+ ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});\r
+\r
+ ed.onNodeChange.add(function(ed, cm, n, co) {\r
+ n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');\r
+\r
+ cm.setDisabled('cite', co);\r
+ cm.setDisabled('acronym', co);\r
+ cm.setDisabled('abbr', co);\r
+ cm.setDisabled('del', co);\r
+ cm.setDisabled('ins', co);\r
+ cm.setDisabled('attribs', n && n.nodeName == 'BODY');\r
+ cm.setActive('cite', 0);\r
+ cm.setActive('acronym', 0);\r
+ cm.setActive('abbr', 0);\r
+ cm.setActive('del', 0);\r
+ cm.setActive('ins', 0);\r
+\r
+ // Activate all\r
+ if (n) {\r
+ do {\r
+ cm.setDisabled(n.nodeName.toLowerCase(), 0);\r
+ cm.setActive(n.nodeName.toLowerCase(), 1);\r
+ } while (n = n.parentNode);\r