diff options
Diffstat (limited to 'plugin/notes')
-rw-r--r-- | plugin/notes/notes.html | 1 | ||||
-rw-r--r-- | plugin/notes/notes.js | 24 |
2 files changed, 20 insertions, 5 deletions
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index 0cc8cf6..75f1b9b 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -239,6 +239,7 @@ // No need for updating the notes in case of fragment changes if ( data.notes ) { notes.classList.remove( 'hidden' ); + notesValue.style.whiteSpace = data.whitespace; if( data.markdown ) { notesValue.innerHTML = marked( data.notes ); } diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 27199af..88f98d6 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -11,10 +11,15 @@ */ var RevealNotes = (function() { - function openNotes() { - var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path - jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path - var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1100,height=700' ); + function openNotes( notesFilePath ) { + + if( !notesFilePath ) { + var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path + jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path + notesFilePath = jsFileLocation + 'notes.html'; + } + + var notesPopup = window.open( notesFilePath, 'reveal.js - Notes', 'width=1100,height=700' ); /** * Connect to the notes window through a postmessage handshake. @@ -28,7 +33,7 @@ var RevealNotes = (function() { notesPopup.postMessage( JSON.stringify( { namespace: 'reveal-notes', type: 'connect', - url: window.location.protocol + '//' + window.location.host + window.location.pathname, + url: window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search, state: Reveal.getState() } ), '*' ); }, 500 ); @@ -55,12 +60,14 @@ var RevealNotes = (function() { type: 'state', notes: '', markdown: false, + whitespace: 'normal', state: Reveal.getState() }; // Look for notes defined in a slide attribute if( slideElement.hasAttribute( 'data-notes' ) ) { messageData.notes = slideElement.getAttribute( 'data-notes' ); + messageData.whitespace = 'pre-wrap'; } // Look for notes defined in an aside element @@ -94,6 +101,7 @@ var RevealNotes = (function() { } connect(); + } if( !/receiver/i.test( window.location.search ) ) { @@ -109,12 +117,18 @@ var RevealNotes = (function() { // 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' ); + } return { open: openNotes }; |