files/reveal.js/plugin/notes/notes.js in reveal-ck-3.8.1 vs files/reveal.js/plugin/notes/notes.js in reveal-ck-3.9.0
- old
+ new
@@ -19,12 +19,17 @@
notesFilePath = jsFileLocation + 'notes.html';
}
var notesPopup = window.open( notesFilePath, 'reveal.js - Notes', 'width=1100,height=700' );
+ if( !notesPopup ) {
+ alert( 'Speaker view popup failed to open. Please make sure popups are allowed and reopen the speaker view.' );
+ return;
+ }
+
// Allow popup window access to Reveal API
- notesPopup.Reveal = this.Reveal;
+ notesPopup.Reveal = window.Reveal;
/**
* Connect to the notes window through a postmessage handshake.
* Using postmessage enables us to work in situations where the
* origins differ, such as a presentation being opened from the
@@ -129,25 +134,12 @@
if( window.location.search.match( /(\?|\&)notes/gi ) !== null ) {
openNotes();
}
// 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();
+ } );
}
return { open: openNotes };