Merge pull request #1958 from ThomasWeinert/feature/block_f5_in_notes

Block F5 in speaker notes window, avoid disconnects
This commit is contained in:
Hakim El Hattab 2017-12-04 13:46:04 +01:00 committed by GitHub
commit edc9c0a8fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -427,10 +427,16 @@
* 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.preventDefault();
}
currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' );
} );