Ticket #2140: 2140_2.patch
File 2140_2.patch, 2.4 KB (added by , 14 years ago) |
---|
-
editor/_source/classes/fckkeystrokehandler.js
76 76 // Get the key code. 77 77 var keystroke = ev.keyCode || ev.which ; 78 78 79 // Combine it with the CTRL, SHIFT and ALT states.80 var keyModifiers = 0;79 // Combine it with the CTRL, SHIFT and ALT states. 80 var keyModifiers = _FCKKeystrokeHandler_GetKeyModifiers(evt) ; 81 81 82 if ( ev.ctrlKey || ev.metaKey ) 83 keyModifiers += CTRL ; 82 var keyCombination = keystroke + keyModifiers ; 84 83 85 if ( ev.shiftKey )86 keyModifiers += SHIFT ;87 88 if ( ev.altKey )89 keyModifiers += ALT ;90 91 var keyCombination = keystroke + keyModifiers ;92 93 84 var cancelIt = keystrokeHandler._CancelIt = false ; 94 85 95 86 // Look for its definition availability. … … 97 88 98 89 // FCKDebug.Output( 'KeyDown: ' + keyCombination + ' - Value: ' + keystrokeValue ) ; 99 90 91 if( keystroke == 13 && ( FCKBrowserInfo.IsGecko && FCKBrowserInfo.IsMac )){ 92 return true; 93 } 94 95 100 96 // If the keystroke is defined 101 97 if ( keystrokeValue ) 102 98 { … … 125 121 return true ; 126 122 } 127 123 124 function _FCKKeystrokeHandler_GetKeyModifiers( ev ) 125 { 126 var keyModifiers = 0; 127 if ( ev.ctrlKey || ev.metaKey ) 128 keyModifiers += CTRL ; 129 130 if ( ev.shiftKey ) 131 keyModifiers += SHIFT ; 132 133 if ( ev.altKey ) 134 keyModifiers += ALT ; 135 } 136 128 137 function _FCKKeystrokeHandler_OnKeyPress( ev, keystrokeHandler ) 129 138 { 139 // Get the key code. 140 var keystroke = ev.keyCode || ev.which ; 141 142 // Combine it with the CTRL, SHIFT and ALT states. 143 var keyModifiers = _FCKKeystrokeHandler_GetKeyModifiers(ev); 144 var keyCombination = keystroke + keyModifiers ; 145 var keystrokeValue = keystrokeHandler.Keystrokes[ keyCombination ] ; 146 147 if( keystroke == 13 && ( FCKBrowserInfo.IsGecko && FCKBrowserInfo.IsMac )){ 148 if ( keystrokeValue ) { 149 if (keystrokeHandler.OnKeystroke) { 150 keystrokeHandler.OnKeystroke.apply( keystrokeHandler, keystrokeValue ); 151 } 152 keystrokeHandler._CancelIt = true; 153 } 154 } 155 130 156 if ( keystrokeHandler._CancelIt ) 131 157 { 132 158 // FCKDebug.Output( 'KeyPress Cancel', 'Red') ;