[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 /* Import plugin specific language pack */ 2 tinyMCE.importPluginLanguagePack('directionality', 'en,sv'); 3 4 function TinyMCE_directionality_getControlHTML(control_name) { 5 var safariPatch = '" onclick="'; 6 7 if (tinyMCE.isSafari) 8 safariPatch = ""; 9 10 switch (control_name) { 11 case "ltr": 12 return '<img id="{$editor_id}_ltr" src="{$pluginurl}/images/ltr.gif" title="{$lang_directionality_ltr_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');' + safariPatch + 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionLTR\');" />'; 13 14 case "rtl": 15 return '<img id="{$editor_id}_rtl" src="{$pluginurl}/images/rtl.gif" title="{$lang_directionality_rtl_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');' + safariPatch + 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionRTL\');" />'; 16 } 17 18 return ""; 19 } 20 21 function TinyMCE_directionality_execCommand(editor_id, element, command, user_interface, value) { 22 // Handle commands 23 switch (command) { 24 case "mceDirectionLTR": 25 var inst = tinyMCE.getInstanceById(editor_id); 26 var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 27 28 if (elm) 29 elm.setAttribute("dir", "ltr"); 30 31 tinyMCE.triggerNodeChange(false); 32 return true; 33 34 case "mceDirectionRTL": 35 var inst = tinyMCE.getInstanceById(editor_id); 36 var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 37 38 if (elm) 39 elm.setAttribute("dir", "rtl"); 40 41 tinyMCE.triggerNodeChange(false); 42 return true; 43 } 44 45 // Pass to next handler in chain 46 return false; 47 } 48 49 function TinyMCE_directionality_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { 50 function getAttrib(elm, name) { 51 return elm.getAttribute(name) ? elm.getAttribute(name) : ""; 52 } 53 54 tinyMCE.switchClassSticky(editor_id + '_ltr', 'mceButtonNormal'); 55 tinyMCE.switchClassSticky(editor_id + '_rtl', 'mceButtonNormal'); 56 57 if (node == null) 58 return; 59 60 var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 61 if (!elm) 62 return; 63 64 var dir = getAttrib(elm, "dir"); 65 if (dir == "ltr" || dir == "") 66 tinyMCE.switchClassSticky(editor_id + '_ltr', 'mceButtonSelected'); 67 else 68 tinyMCE.switchClassSticky(editor_id + '_rtl', 'mceButtonSelected'); 69 70 return true; 71 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |