1 var EA_keys = {8:"Retour arriere",9:"Tabulation",12:"Milieu (pave numerique)",13:"Entrer",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"Verr Maj",27:"Esc",32:"Space",33:"Page up",34:"Page down",35:"End",36:"Begin",37:"Left",38:"Up",39:"Right",40:"Down",44:"Impr ecran",45:"Inser",46:"Suppr",91:"Menu Demarrer Windows / touche pomme Mac",92:"Menu Demarrer Windows",93:"Menu contextuel Windows",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Verr Num",145:"Arret defil"};
\r
10 // send the event to the plugins
\r
11 for(var i in editArea.plugins){
\r
12 if(typeof(editArea.plugins[i].onkeydown)=="function"){
\r
13 if(editArea.plugins[i].onkeydown(e)===false){ // stop propaging
\r
21 var target_id=(e.target || e.srcElement).id;
\r
23 if (EA_keys[e.keyCode])
\r
24 letter=EA_keys[e.keyCode];
\r
26 letter=String.fromCharCode(e.keyCode);
\r
28 var low_letter= letter.toLowerCase();
\r
30 if(letter=="Page up" && !editArea.isOpera){
\r
31 editArea.execCommand("scroll_page", {"dir": "up", "shift": ShiftPressed(e)});
\r
33 }else if(letter=="Page down" && !editArea.isOpera){
\r
34 editArea.execCommand("scroll_page", {"dir": "down", "shift": ShiftPressed(e)});
\r
36 }else if(editArea.is_editable==false){
\r
37 // do nothing but also do nothing else (allow to navigate with page up and page down)
\r
39 }else if(letter=="Tabulation" && target_id=="textarea" && !CtrlPressed(e) && !AltPressed(e)){
\r
41 editArea.execCommand("invert_tab_selection");
\r
43 editArea.execCommand("tab_selection");
\r
46 if(editArea.isOpera || (editArea.isFirefox && editArea.isMac) ) // opera && firefox mac can't cancel tabulation events...
\r
47 setTimeout("editArea.execCommand('focus');", 1);
\r
48 }else if(letter=="Entrer" && target_id=="textarea"){
\r
49 if(editArea.press_enter())
\r
51 }else if(letter=="Entrer" && target_id=="area_search"){
\r
52 editArea.execCommand("area_search");
\r
54 }else if(letter=="Esc"){
\r
55 editArea.execCommand("close_all_inline_popup", e);
\r
57 }else if(CtrlPressed(e) && !AltPressed(e) && !ShiftPressed(e)){
\r
60 editArea.execCommand("area_search");
\r
64 editArea.execCommand("area_replace");
\r
68 editArea.execCommand("close_all_inline_popup", e);
\r
72 editArea.execCommand("change_highlight");
\r
76 setTimeout("editArea.execCommand('go_to_line');", 5); // the prompt stop the return false otherwise
\r
80 editArea.execCommand("show_help");
\r
85 editArea.execCommand("undo");
\r
89 editArea.execCommand("redo");
\r
96 // check to disable the redo possibility if the textarea content change
\r
97 if(editArea.next.length > 0){
\r
98 setTimeout("editArea.check_redo();", 10);
\r
101 setTimeout("editArea.check_file_changes();", 10);
\r
105 // in case of a control that sould'nt be used by IE but that is used => THROW a javascript error that will stop key action
\r
110 //alert("Test: "+ letter + " ("+e.keyCode+") ALT: "+ AltPressed(e) + " CTRL "+ CtrlPressed(e) + " SHIFT "+ ShiftPressed(e));
\r
117 // return true if Alt key is pressed
\r
118 function AltPressed(e) {
\r
119 if (window.event) {
\r
120 return (window.event.altKey);
\r
123 return (e.altKey || (e.modifiers % 2));
\r
129 // return true if Ctrl key is pressed
\r
130 function CtrlPressed(e) {
\r
131 if (window.event) {
\r
132 return (window.event.ctrlKey);
\r
134 return (e.ctrlKey || (e.modifiers==2) || (e.modifiers==3) || (e.modifiers>5));
\r
138 // return true if Shift key is pressed
\r
139 function ShiftPressed(e) {
\r
140 if (window.event) {
\r
141 return (window.event.shiftKey);
\r
143 return (e.shiftKey || (e.modifiers>3));
\r