Skip to content

Commit

Permalink
Merge branch 'plugin-key-bindings' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
denehyg committed Sep 8, 2018
2 parents bcee8aa + 701358b commit 25726a1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,13 @@ var RevealMenu = window.RevealMenu || (function(){
}

function onDocumentKeyDown(event) {
if (event.keyCode === 77) {
toggleMenu();
} else if (isOpen()) {
// opening menu is handled by registering key binding with Reveal below
if (isOpen()) {
event.stopImmediatePropagation();
switch( event.keyCode ) {
// case 77:
// closeMenu();
// break;
// h, left - change panel
case 72: case 37:
prevPanel();
Expand Down Expand Up @@ -297,11 +299,13 @@ var RevealMenu = window.RevealMenu || (function(){
if (config.keyboardCondition && typeof config.keyboardCondition === 'function') {
// combine user defined keyboard condition with the menu's own condition
var userCondition = config.keyboardCondition;
config.keyboardCondition = function() {
return userCondition() && !isOpen();
config.keyboardCondition = function(event) {
return userCondition(event) && (!isOpen() || event.keyCode == 77);
};
} else {
config.keyboardCondition = function() { return !isOpen(); }
config.keyboardCondition = function(event) {
return !isOpen() || event.keyCode == 77;
}
}
}

Expand Down Expand Up @@ -842,6 +846,8 @@ var RevealMenu = window.RevealMenu || (function(){
}
}

Reveal.addKeyBinding({keyCode: 77, key: 'M', description: 'Toggle menu'}, toggleMenu);

dispatchEvent('menu-ready');
}
}
Expand Down

1 comment on commit 25726a1

@3opk23
Copy link

@3opk23 3opk23 commented on 25726a1 Apr 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Details

160 Fork denehyg/reveal.js-menu
Code Issues 5 Pull requests 0 Wiki Releases More
Browse files
Merge branch 'plugin-key-bindings' into dev

master 1.2.0

denehyg committed on Sep 8, 2018
2 parents bcee8aa + 701358b commit 25726a1 patch diff
No Whitespace
Showing 1 changed file with 12 additions and 6 deletions.
View file
18 menu.js

Please sign in to comment.