浏览代码

Listen to custom mapped togglePause keys

This resolves issue #941
David Banham 10 年之前
父节点
当前提交
a078c87f10
共有 2 个文件被更改,包括 8 次插入3 次删除
  1. 7 2
      js/reveal.js
  2. 1 1
      js/reveal.min.js

+ 7 - 2
js/reveal.js

@@ -2658,8 +2658,13 @@ var Reveal = (function(){
 		// keyboard modifier key is present
 		if( hasFocus || (event.shiftKey && event.keyCode !== 32) || event.altKey || event.ctrlKey || event.metaKey ) return;
 
-		// While paused only allow "unpausing" keyboard events (b and .)
-		if( isPaused() && [66,190,191].indexOf( event.keyCode ) === -1 ) {
+		// While paused only allow "unpausing" keyboard events ('b', '.' or any key specifically mapped to togglePause )
+		var allowedKeys = [66,190,191].concat(Object.keys(config.keyboard).map(function(key){
+			if (config.keyboard[key] === 'togglePause') {
+				return parseInt(key, 10);
+			}
+		}));
+		if( isPaused() && allowedKeys.indexOf( event.keyCode ) === -1 ) {
 			return false;
 		}
 

文件差异内容过多而无法显示
+ 1 - 1
js/reveal.min.js


部分文件因为文件数量过多而无法显示