[ Index ] |
|
Code source de Seagull 0.6.1 |
1 /** 2 * $RCSfile: editor_plugin_src.js,v $ 3 * $Revision: 1.16 $ 4 * $Date: 2006/02/10 21:34:28 $ 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('directionality', 'en,tr,sv,fr_ca,zh_cn,cs,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,pl,nl,fr,pt_br'); 12 13 var TinyMCE_DirectionalityPlugin = { 14 getInfo : function() { 15 return { 16 longname : 'Directionality', 17 author : 'Moxiecode Systems', 18 authorurl : 'http://tinymce.moxiecode.com', 19 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html', 20 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 21 }; 22 }, 23 24 getControlHTML : function(cn) { 25 switch (cn) { 26 case "ltr": 27 return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR'); 28 29 case "rtl": 30 return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL'); 31 } 32 33 return ""; 34 }, 35 36 execCommand : function(editor_id, element, command, user_interface, value) { 37 // Handle commands 38 switch (command) { 39 case "mceDirectionLTR": 40 var inst = tinyMCE.getInstanceById(editor_id); 41 var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 42 43 if (elm) 44 elm.setAttribute("dir", "ltr"); 45 46 tinyMCE.triggerNodeChange(false); 47 return true; 48 49 case "mceDirectionRTL": 50 var inst = tinyMCE.getInstanceById(editor_id); 51 var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 52 53 if (elm) 54 elm.setAttribute("dir", "rtl"); 55 56 tinyMCE.triggerNodeChange(false); 57 return true; 58 } 59 60 // Pass to next handler in chain 61 return false; 62 }, 63 64 handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { 65 function getAttrib(elm, name) { 66 return elm.getAttribute(name) ? elm.getAttribute(name) : ""; 67 } 68 69 if (node == null) 70 return; 71 72 var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 73 if (!elm) { 74 tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonDisabled'); 75 tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonDisabled'); 76 return true; 77 } 78 79 tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal'); 80 tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal'); 81 82 var dir = getAttrib(elm, "dir"); 83 if (dir == "ltr" || dir == "") 84 tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected'); 85 else 86 tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected'); 87 88 return true; 89 } 90 }; 91 92 tinyMCE.addPlugin("directionality", TinyMCE_DirectionalityPlugin);
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 |