diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/notes/notes.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index e488075..30e1669 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -208,6 +208,7 @@ connected = true; setupIframes( data ); + setupKeyboard(); setupNotes(); setupTimer(); } @@ -248,6 +249,19 @@ handleStateMessage = debounce( handleStateMessage, 200 ); /** + * 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. + */ + function setupKeyboard() { + + document.addEventListener( 'keydown', function( event ) { + currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' ); + } ); + + } + + /** * Creates the preview iframes. */ function setupIframes( data ) { |