@@ -105,7 +105,8 @@ define(function (require, exports, module) {
105105 Commands . EDIT_CUT , Commands . EDIT_COPY , Commands . EDIT_PASTE ] ,
106106 _reservedShortcuts = [ "Ctrl-Z" , "Ctrl-Y" , "Ctrl-A" , "Ctrl-X" , "Ctrl-C" , "Ctrl-V" ] ,
107107 _macReservedShortcuts = [ "Cmd-," , "Cmd-H" , "Cmd-Alt-H" , "Cmd-M" , "Cmd-Shift-Z" , "Cmd-Q" ] ,
108- _keyNames = [ "Up" , "Down" , "Left" , "Right" , "Backspace" , "Enter" , "Space" , "Tab" ] ;
108+ _keyNames = [ "Up" , "Down" , "Left" , "Right" , "Backspace" , "Enter" , "Space" , "Tab" ,
109+ "PageUp" , "PageDown" , "Home" , "End" , "Insert" , "Delete" ] ;
109110
110111 /**
111112 * @private
@@ -402,11 +403,16 @@ define(function (require, exports, module) {
402403 return null ;
403404 }
404405
405- // Ensure that the first letter of the key name is in upper case.
406- // i.e. 'a' => 'A' and 'up' => 'Up'
407- if ( / ^ [ a - z ] / . test ( key ) ) {
408- key = key . toLowerCase ( ) . replace ( / ( ^ [ a - z ] ) / , function ( match , p1 ) {
409- return p1 . toUpperCase ( ) ;
406+ // Ensure that the first letter of the key name is in upper case and the rest are
407+ // in lower case. i.e. 'a' => 'A' and 'up' => 'Up'
408+ if ( / ^ [ a - z ] / i. test ( key ) ) {
409+ key = key . charAt ( 0 ) . toUpperCase ( ) + key . substr ( 1 ) . toLowerCase ( ) ;
410+ }
411+
412+ // Also make sure that the second word of PageUp/PageDown has the first letter in upper case.
413+ if ( / ^ P a g e / . test ( key ) ) {
414+ key = key . replace ( / ( u p | d o w n ) $ / , function ( match , p1 ) {
415+ return p1 . charAt ( 0 ) . toUpperCase ( ) + p1 . substr ( 1 ) ;
410416 } ) ;
411417 }
412418
@@ -504,6 +510,10 @@ define(function (require, exports, module) {
504510 key = "Space" ;
505511 } else if ( key === "\b" ) {
506512 key = "Backspace" ;
513+ } else if ( key === "Help" ) {
514+ key = "Insert" ;
515+ } else if ( event . keyCode === KeyEvent . DOM_VK_DELETE ) {
516+ key = "Delete" ;
507517 } else {
508518 key = _mapKeycodeToKey ( event . keyCode , key ) ;
509519 }
@@ -1084,7 +1094,7 @@ define(function (require, exports, module) {
10841094 function _getDisplayKey ( key ) {
10851095 var displayKey = "" ,
10861096 match = key ? key . match ( / ( U p | D o w n | L e f t | R i g h t | \- ) $ / i) : null ;
1087- if ( match ) {
1097+ if ( match && ! / P a g e ( U p | D o w n ) / . test ( key ) ) {
10881098 displayKey = key . substr ( 0 , match . index ) + _displayKeyMap [ match [ 0 ] . toLowerCase ( ) ] ;
10891099 }
10901100 return displayKey ;
0 commit comments