From 7297474b2e683f6e6e382891b2ec36e7f22c0764 Mon Sep 17 00:00:00 2001 From: Greg Denehy Date: Sun, 30 Apr 2017 15:23:04 +0930 Subject: Added programatic support for custom key bindings with optional descriptions to be added to the help screen --- plugin/notes/notes.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'plugin') diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 202e73b..8980fb4 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -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); } -- cgit v1.2.3 From e48e1e19b97d99de107966dd3f8c431a89457972 Mon Sep 17 00:00:00 2001 From: Greg Denehy Date: Sun, 30 Apr 2017 16:35:35 +0930 Subject: Changed custom key binding config properties to use 'keyCode' instead of 'code' --- plugin/notes/notes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 8980fb4..6373d97 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -106,7 +106,7 @@ var RevealNotes = (function() { } // Open the notes when the 's' key is hit - Reveal.addKeyBinding({code: 83, key: 'S', description: 'Speaker notes'}, openNotes); + Reveal.addKeyBinding({keyCode: 83, key: 'S', description: 'Speaker notes'}, openNotes); } -- cgit v1.2.3 From e16508477ab541314452997d20aa6bdb5a8b0862 Mon Sep 17 00:00:00 2001 From: Greg Denehy Date: Sun, 30 Apr 2017 17:51:38 +0930 Subject: Fixed notes.js to account for upstream updates --- plugin/notes/notes.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'plugin') diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 1a35110..3f00eb6 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -131,10 +131,9 @@ var RevealNotes = (function() { } // Open the notes when the 's' key is hit - Reveal.addKeyBinding({keyCode: 83, key: 'S', description: 'Speaker notes'}, openNotes); - - // Show our keyboard shortcut in the reveal.js help overlay - if( window.Reveal ) Reveal.registerKeyboardShortcut( 'S', 'Speaker notes view' ); + Reveal.addKeyBinding({keyCode: 83, key: 'S', description: 'Speaker notes view'}, function() { + openNotes(); + } ); } -- cgit v1.2.3