[ Index ] |
|
Code source de Seagull 0.6.1 |
1 /** 2 * $RCSfile: editor_plugin_src.js,v $ 3 * $Revision: 1.24 $ 4 * $Date: 2006/02/10 16:29:38 $ 5 * 6 * @author Moxiecode 7 * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved. 8 */ 9 10 /* Import plugin specific language pack */ 11 tinyMCE.importPluginLanguagePack('advlink', 'en,tr,de,sv,zh_cn,cs,fa,fr_ca,fr,pl,pt_br,nl,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,cy,es,is,zh_tw,zh_tw_utf8,sk,da'); 12 13 var TinyMCE_AdvancedLinkPlugin = { 14 getInfo : function() { 15 return { 16 longname : 'Advanced link', 17 author : 'Moxiecode Systems', 18 authorurl : 'http://tinymce.moxiecode.com', 19 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_advlink.html', 20 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 21 }; 22 }, 23 24 initInstance : function(inst) { 25 inst.addShortcut('ctrl', 'k', 'lang_advlink_desc', 'mceAdvLink'); 26 }, 27 28 getControlHTML : function(cn) { 29 switch (cn) { 30 case "link": 31 return tinyMCE.getButtonHTML(cn, 'lang_link_desc', '{$themeurl}/images/link.gif', 'mceAdvLink'); 32 } 33 34 return ""; 35 }, 36 37 execCommand : function(editor_id, element, command, user_interface, value) { 38 switch (command) { 39 case "mceAdvLink": 40 var anySelection = false; 41 var inst = tinyMCE.getInstanceById(editor_id); 42 var focusElm = inst.getFocusElement(); 43 var selectedText = inst.selection.getSelectedText(); 44 45 if (tinyMCE.selectedElement) 46 anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (selectedText && selectedText.length > 0); 47 48 if (anySelection || (focusElm != null && focusElm.nodeName == "A")) { 49 var template = new Array(); 50 51 template['file'] = '../../plugins/advlink/link.htm'; 52 template['width'] = 480; 53 template['height'] = 400; 54 55 // Language specific width and height addons 56 template['width'] += tinyMCE.getLang('lang_advlink_delta_width', 0); 57 template['height'] += tinyMCE.getLang('lang_advlink_delta_height', 0); 58 59 tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"}); 60 } 61 62 return true; 63 } 64 65 return false; 66 }, 67 68 handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { 69 if (node == null) 70 return; 71 72 do { 73 if (node.nodeName == "A" && tinyMCE.getAttrib(node, 'href') != "") { 74 tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonSelected'); 75 return true; 76 } 77 } while ((node = node.parentNode)); 78 79 if (any_selection) { 80 tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonNormal'); 81 return true; 82 } 83 84 tinyMCE.switchClass(editor_id + '_advlink', 'mceButtonDisabled'); 85 86 return true; 87 } 88 }; 89 90 tinyMCE.addPlugin("advlink", TinyMCE_AdvancedLinkPlugin);
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 30 01:27:52 2007 | par Balluche grâce à PHPXref 0.7 |