bgneal@312: /** bgneal@312: * editor_plugin_src.js bgneal@312: * bgneal@312: * Copyright 2009, Moxiecode Systems AB bgneal@312: * Released under LGPL License. bgneal@312: * bgneal@312: * License: http://tinymce.moxiecode.com/license bgneal@312: * Contributing: http://tinymce.moxiecode.com/contributing bgneal@312: */ bgneal@312: bgneal@312: (function() { bgneal@312: tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', { bgneal@312: init : function(ed, url) { bgneal@312: // Register commands bgneal@312: ed.addCommand('mceCite', function() { bgneal@312: ed.windowManager.open({ bgneal@312: file : url + '/cite.htm', bgneal@312: width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)), bgneal@312: height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)), bgneal@312: inline : 1 bgneal@312: }, { bgneal@312: plugin_url : url bgneal@312: }); bgneal@312: }); bgneal@312: bgneal@312: ed.addCommand('mceAcronym', function() { bgneal@312: ed.windowManager.open({ bgneal@312: file : url + '/acronym.htm', bgneal@312: width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)), bgneal@312: height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)), bgneal@312: inline : 1 bgneal@312: }, { bgneal@312: plugin_url : url bgneal@312: }); bgneal@312: }); bgneal@312: bgneal@312: ed.addCommand('mceAbbr', function() { bgneal@312: ed.windowManager.open({ bgneal@312: file : url + '/abbr.htm', bgneal@312: width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)), bgneal@312: height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)), bgneal@312: inline : 1 bgneal@312: }, { bgneal@312: plugin_url : url bgneal@312: }); bgneal@312: }); bgneal@312: bgneal@312: ed.addCommand('mceDel', function() { bgneal@312: ed.windowManager.open({ bgneal@312: file : url + '/del.htm', bgneal@312: width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)), bgneal@312: height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)), bgneal@312: inline : 1 bgneal@312: }, { bgneal@312: plugin_url : url bgneal@312: }); bgneal@312: }); bgneal@312: bgneal@312: ed.addCommand('mceIns', function() { bgneal@312: ed.windowManager.open({ bgneal@312: file : url + '/ins.htm', bgneal@312: width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)), bgneal@312: height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)), bgneal@312: inline : 1 bgneal@312: }, { bgneal@312: plugin_url : url bgneal@312: }); bgneal@312: }); bgneal@312: bgneal@312: ed.addCommand('mceAttributes', function() { bgneal@312: ed.windowManager.open({ bgneal@312: file : url + '/attributes.htm', bgneal@312: width : 380, bgneal@312: height : 370, bgneal@312: inline : 1 bgneal@312: }, { bgneal@312: plugin_url : url bgneal@312: }); bgneal@312: }); bgneal@312: bgneal@312: // Register buttons bgneal@312: ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'}); bgneal@312: ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'}); bgneal@312: ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'}); bgneal@312: ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'}); bgneal@312: ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'}); bgneal@312: ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'}); bgneal@312: bgneal@312: ed.onNodeChange.add(function(ed, cm, n, co) { bgneal@312: n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS'); bgneal@312: bgneal@312: cm.setDisabled('cite', co); bgneal@312: cm.setDisabled('acronym', co); bgneal@312: cm.setDisabled('abbr', co); bgneal@312: cm.setDisabled('del', co); bgneal@312: cm.setDisabled('ins', co); bgneal@312: cm.setDisabled('attribs', n && n.nodeName == 'BODY'); bgneal@312: cm.setActive('cite', 0); bgneal@312: cm.setActive('acronym', 0); bgneal@312: cm.setActive('abbr', 0); bgneal@312: cm.setActive('del', 0); bgneal@312: cm.setActive('ins', 0); bgneal@312: bgneal@312: // Activate all bgneal@312: if (n) { bgneal@312: do { bgneal@312: cm.setDisabled(n.nodeName.toLowerCase(), 0); bgneal@312: cm.setActive(n.nodeName.toLowerCase(), 1); bgneal@312: } while (n = n.parentNode); bgneal@312: } bgneal@312: }); bgneal@312: bgneal@312: ed.onPreInit.add(function() { bgneal@312: // Fixed IE issue where it can't handle these elements correctly bgneal@312: ed.dom.create('abbr'); bgneal@312: }); bgneal@312: }, bgneal@312: bgneal@312: getInfo : function() { bgneal@312: return { bgneal@312: longname : 'XHTML Xtras Plugin', bgneal@312: author : 'Moxiecode Systems AB', bgneal@312: authorurl : 'http://tinymce.moxiecode.com', bgneal@312: infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras', bgneal@312: version : tinymce.majorVersion + "." + tinymce.minorVersion bgneal@312: }; bgneal@312: } bgneal@312: }); bgneal@312: bgneal@312: // Register plugin bgneal@312: tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin); bgneal@312: })();