Ticket #2140: 2140_2.patch

File 2140_2.patch, 2.4 KB (added by Alfonso Martínez de Lizarrondo, 15 years ago)

Patch version of Keit file

  • editor/_source/classes/fckkeystrokehandler.js

     
    7676        // Get the key code.
    7777        var keystroke = ev.keyCode || ev.which ;
    7878
    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) ;
    8181
    82         if ( ev.ctrlKey || ev.metaKey )
    83                 keyModifiers += CTRL ;
     82        var keyCombination = keystroke + keyModifiers ;
    8483
    85         if ( ev.shiftKey )
    86                 keyModifiers += SHIFT ;
    87 
    88         if ( ev.altKey )
    89                 keyModifiers += ALT ;
    90 
    91         var keyCombination = keystroke + keyModifiers ;
    92 
    9384        var cancelIt = keystrokeHandler._CancelIt = false ;
    9485
    9586        // Look for its definition availability.
     
    9788
    9889//      FCKDebug.Output( 'KeyDown: ' + keyCombination + ' - Value: ' + keystrokeValue ) ;
    9990
     91        if( keystroke == 13 && ( FCKBrowserInfo.IsGecko && FCKBrowserInfo.IsMac )){
     92                return true;
     93        }
     94
     95
    10096        // If the keystroke is defined
    10197        if ( keystrokeValue )
    10298        {
     
    125121        return true ;
    126122}
    127123
     124function _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
    128137function _FCKKeystrokeHandler_OnKeyPress( ev, keystrokeHandler )
    129138{
     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 
    130156        if ( keystrokeHandler._CancelIt )
    131157        {
    132158//              FCKDebug.Output( 'KeyPress Cancel', 'Red') ;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy