diff options
author | Sean Parent | 2018-04-13 07:55:02 -0700 |
---|---|---|
committer | GitHub | 2018-04-13 07:55:02 -0700 |
commit | 97c1a0ecc1bf729dbe227ed0a3af0bfd3bc38613 (patch) | |
tree | 4fd0f338f0f58a46f213daaaa4744df4980bf45b /plugin/notes | |
parent | 64b2a27455240e57c2cc1a90300391a3c3b91e28 (diff) | |
parent | 397feab8b4be5f8445ebb05808b507248188d4fe (diff) |
Merge branch 'dev' into master
Diffstat (limited to 'plugin/notes')
-rw-r--r-- | plugin/notes/notes.html | 7 | ||||
-rw-r--r-- | plugin/notes/notes.js | 19 |
2 files changed, 10 insertions, 16 deletions
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 4c5b799..5b75d73 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -427,10 +427,17 @@ * Forward keyboard events to the current slide window. * This enables keyboard events to work even if focus * isn't set on the current slide iframe. + * + * Block F5 default handling, it reloads and disconnects + * the speaker notes window. */ function setupKeyboard() { document.addEventListener( 'keydown', function( event ) { + if( event.keyCode === 116 || ( event.metaKey && event.keyCode === 82 ) ) { + event.preventDefault(); + return false; + } currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' ); } ); diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 80fb6e2..3f00eb6 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -131,22 +131,9 @@ 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 ); - - // 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(); + } ); } |