Merge pull request #1636 from traff/master

For a fragment: allow to show a separate note defined in it
This commit is contained in:
Hakim El Hattab 2017-01-31 16:47:29 +01:00 committed by GitHub
commit 1413cbc1a9
1 changed files with 10 additions and 1 deletions

View File

@ -50,7 +50,7 @@ var RevealNotes = (function() {
/** /**
* Posts the current slide data to the notes window * Posts the current slide data to the notes window
*/ */
function post() { function post(event) {
var slideElement = Reveal.getCurrentSlide(), var slideElement = Reveal.getCurrentSlide(),
notesElement = slideElement.querySelector( 'aside.notes' ); notesElement = slideElement.querySelector( 'aside.notes' );
@ -64,6 +64,15 @@ var RevealNotes = (function() {
state: Reveal.getState() state: Reveal.getState()
}; };
// Look for notes defined in a fragment, if it is a fragmentshown event
if (event && event.hasOwnProperty('fragment')) {
var innerNotes = event.fragment.querySelector( 'aside.notes' );
if ( innerNotes) {
notesElement = innerNotes;
}
}
// Look for notes defined in a slide attribute // Look for notes defined in a slide attribute
if( slideElement.hasAttribute( 'data-notes' ) ) { if( slideElement.hasAttribute( 'data-notes' ) ) {
messageData.notes = slideElement.getAttribute( 'data-notes' ); messageData.notes = slideElement.getAttribute( 'data-notes' );