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

View File

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