Просмотр исходного кода

fix object.keys call on non-object

Hakim El Hattab 9 лет назад
Родитель
Сommit
1bf236a079
1 измененных файлов с 11 добавлено и 7 удалено
  1. 11 7
      js/reveal.js

+ 11 - 7
js/reveal.js

@@ -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;