fix object.keys call on non-object

This commit is contained in:
Hakim El Hattab 2015-08-14 23:16:59 +02:00
parent de3e1daab4
commit 1bf236a079
1 changed files with 11 additions and 7 deletions

View File

@ -3771,13 +3771,17 @@
// keyboard modifier key is present // keyboard modifier key is present
if( activeElementIsCE || activeElementIsInput || (event.shiftKey && event.keyCode !== 32) || event.altKey || event.ctrlKey || event.metaKey ) return; if( activeElementIsCE || activeElementIsInput || (event.shiftKey && event.keyCode !== 32) || event.altKey || event.ctrlKey || event.metaKey ) return;
// While paused only allow resume keyboard events; // While paused only allow resume keyboard events; 'b', '.''
// 'b', '.' or any key specifically mapped to togglePause var resumeKeyCodes = [66,190,191];
var resumeKeyCodes = [66,190,191].concat( Object.keys( config.keyboard ).map( function( key ) {
if( config.keyboard[key] === 'togglePause' ) { // Custom key bindings for togglePause should be able to resume
return parseInt( key, 10 ); if( typeof config.keyboard === 'object' ) {
} resumeKeyCodes = resumeKeyCodes.concat( Object.keys( config.keyboard ).map( function( key ) {
})); if( config.keyboard[key] === 'togglePause' ) {
return parseInt( key, 10 );
}
}));
}
if( isPaused() && resumeKeyCodes.indexOf( event.keyCode ) === -1 ) { if( isPaused() && resumeKeyCodes.indexOf( event.keyCode ) === -1 ) {
return false; return false;