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.AdvancedLinkPlugin', { bgneal@312: init : function(ed, url) { bgneal@312: this.editor = ed; bgneal@312: bgneal@312: // Register commands bgneal@312: ed.addCommand('mceAdvLink', function() { bgneal@312: var se = ed.selection; bgneal@312: bgneal@312: // No selection and not in link bgneal@312: if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A')) bgneal@312: return; bgneal@312: bgneal@312: ed.windowManager.open({ bgneal@312: file : url + '/link.htm', bgneal@312: width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)), bgneal@312: height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)), 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('link', { bgneal@312: title : 'advlink.link_desc', bgneal@312: cmd : 'mceAdvLink' bgneal@312: }); bgneal@312: bgneal@312: ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink'); bgneal@312: bgneal@312: ed.onNodeChange.add(function(ed, cm, n, co) { bgneal@312: cm.setDisabled('link', co && n.nodeName != 'A'); bgneal@312: cm.setActive('link', n.nodeName == 'A' && !n.name); bgneal@312: }); bgneal@312: }, bgneal@312: bgneal@312: getInfo : function() { bgneal@312: return { bgneal@312: longname : 'Advanced link', bgneal@312: author : 'Moxiecode Systems AB', bgneal@312: authorurl : 'http://tinymce.moxiecode.com', bgneal@312: infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', bgneal@312: version : tinymce.majorVersion + "." + tinymce.minorVersion bgneal@312: }; bgneal@312: } bgneal@312: }); bgneal@312: bgneal@312: // Register plugin bgneal@312: tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin); bgneal@312: })();