bgneal@45: /** bgneal@183: * editor_plugin_src.js bgneal@45: * bgneal@183: * Copyright 2009, Moxiecode Systems AB bgneal@183: * Released under LGPL License. bgneal@183: * bgneal@183: * License: http://tinymce.moxiecode.com/license bgneal@183: * Contributing: http://tinymce.moxiecode.com/contributing bgneal@45: */ bgneal@45: bgneal@45: (function() { bgneal@45: tinymce.create('tinymce.plugins.AdvancedLinkPlugin', { bgneal@45: init : function(ed, url) { bgneal@45: this.editor = ed; bgneal@45: bgneal@45: // Register commands bgneal@45: ed.addCommand('mceAdvLink', function() { bgneal@45: var se = ed.selection; bgneal@45: bgneal@45: // No selection and not in link bgneal@45: if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A')) bgneal@45: return; bgneal@45: bgneal@45: ed.windowManager.open({ bgneal@45: file : url + '/link.htm', bgneal@45: width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)), bgneal@45: height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)), bgneal@45: inline : 1 bgneal@45: }, { bgneal@45: plugin_url : url bgneal@45: }); bgneal@45: }); bgneal@45: bgneal@45: // Register buttons bgneal@45: ed.addButton('link', { bgneal@45: title : 'advlink.link_desc', bgneal@45: cmd : 'mceAdvLink' bgneal@45: }); bgneal@45: bgneal@45: ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink'); bgneal@45: bgneal@45: ed.onNodeChange.add(function(ed, cm, n, co) { bgneal@45: cm.setDisabled('link', co && n.nodeName != 'A'); bgneal@45: cm.setActive('link', n.nodeName == 'A' && !n.name); bgneal@45: }); bgneal@45: }, bgneal@45: bgneal@45: getInfo : function() { bgneal@45: return { bgneal@45: longname : 'Advanced link', bgneal@45: author : 'Moxiecode Systems AB', bgneal@45: authorurl : 'http://tinymce.moxiecode.com', bgneal@45: infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink', bgneal@45: version : tinymce.majorVersion + "." + tinymce.minorVersion bgneal@45: }; bgneal@45: } bgneal@45: }); bgneal@45: bgneal@45: // Register plugin bgneal@45: tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin); bgneal@45: })();