Block F5 in speaker notes window, avoid disconnects

This commit is contained in:
Thomas Weinert 2017-08-12 13:38:46 +02:00
parent bfd431a0c4
commit c0109d948f
1 changed files with 6 additions and 0 deletions

View File

@ -427,10 +427,16 @@
* Forward keyboard events to the current slide window. * Forward keyboard events to the current slide window.
* This enables keyboard events to work even if focus * This enables keyboard events to work even if focus
* isn't set on the current slide iframe. * isn't set on the current slide iframe.
*
* Block F5 default handling, it reloads and disconnects
* the speaker notes window.
*/ */
function setupKeyboard() { function setupKeyboard() {
document.addEventListener( 'keydown', function( event ) { document.addEventListener( 'keydown', function( event ) {
if (event.keyCode === 116) {
event.preventDefault();
}
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' ); currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' );
} ); } );