2 * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
\r
5 * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
\r
8 /* Import plugin specific language pack */
\r
9 tinyMCE.importPluginLanguagePack('advlink');
\r
11 var TinyMCE_AdvancedLinkPlugin = {
\r
12 getInfo : function() {
\r
14 longname : 'Advanced link',
\r
15 author : 'Moxiecode Systems AB',
\r
16 authorurl : 'http://tinymce.moxiecode.com',
\r
17 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_advlink.html',
\r
18 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
\r
22 initInstance : function(inst) {
\r
23 inst.addShortcut('ctrl', 'k', 'lang_advlink_desc', 'mceAdvLink');
\r
26 getControlHTML : function(cn) {
\r
29 return tinyMCE.getButtonHTML(cn, 'lang_link_desc', '{$themeurl}/images/link.gif', 'mceAdvLink');
\r
35 execCommand : function(editor_id, element, command, user_interface, value) {
\r
38 var anySelection = false;
\r
39 var inst = tinyMCE.getInstanceById(editor_id);
\r
40 var focusElm = inst.getFocusElement();
\r
41 var selectedText = inst.selection.getSelectedText();
\r
43 if (tinyMCE.selectedElement)
\r
44 anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (selectedText && selectedText.length > 0);
\r
46 if (anySelection || (focusElm != null && focusElm.nodeName == "A")) {
\r
47 var template = new Array();
\r
49 template['file'] = '../../plugins/advlink/link.htm';
\r
50 template['width'] = 480;
\r
51 template['height'] = 400;
\r
53 // Language specific width and height addons
\r
54 template['width'] += tinyMCE.getLang('lang_advlink_delta_width', 0);
\r
55 template['height'] += tinyMCE.getLang('lang_advlink_delta_height', 0);
\r
57 tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
\r
66 handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
\r
71 if (node.nodeName == "A" && tinyMCE.getAttrib(node, 'href') != "") {
\r
72 tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonSelected');
\r
75 } while ((node = node.parentNode));
\r
77 if (any_selection) {
\r
78 tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonNormal');
\r
82 tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonDisabled');
\r
88 tinyMCE.addPlugin("advlink", TinyMCE_AdvancedLinkPlugin);
\r