Added programatic support for custom key bindings with optional descriptions to be added to the help screen

This commit is contained in:
Greg Denehy
2017-04-30 15:23:04 +09:30
parent 91c6db71ca
commit 7297474b2e
2 changed files with 70 additions and 15 deletions

View File

@ -106,19 +106,7 @@ var RevealNotes = (function() {
}
// Open the notes when the 's' key is hit
document.addEventListener( 'keydown', function( event ) {
// Disregard the event if the target is editable or a
// modifier is present
if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
// Disregard the event if keyboard is disabled
if ( Reveal.getConfig().keyboard === false ) return;
if( event.keyCode === 83 ) {
event.preventDefault();
openNotes();
}
}, false );
Reveal.addKeyBinding({code: 83, key: 'S', description: 'Speaker notes'}, openNotes);
}