aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-04-26 11:35:55 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-04-26 11:36:03 +0200
commit1e5ca748a49b35ec698fc73d0420bb63534b9ae7 (patch)
tree5e82781030c5659d83b44880f2e34785f2be9c75 /plugin
parent54ca9edeed077c4f7e564d0fa26c086af28a02ee (diff)
downloadperl-software-in-gnu-guix-1e5ca748a49b35ec698fc73d0420bb63534b9ae7.tar
perl-software-in-gnu-guix-1e5ca748a49b35ec698fc73d0420bb63534b9ae7.tar.gz
enable reveal.js keyboard shortcuts anywhere in notes window
Diffstat (limited to 'plugin')
-rw-r--r--plugin/notes/notes.html14
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 ) {