diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-01-31 17:08:08 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-01-31 17:08:08 +0100 |
commit | f496613dd3309a3066642adf1261e9da0578cdda (patch) | |
tree | 7c5f15b0b4496c824052d28ec6340f8fe3e81be8 /plugin | |
parent | c49f76d2714ac54b4acbd49a04f28f5cbc9a006e (diff) | |
download | perl-software-in-gnu-guix-f496613dd3309a3066642adf1261e9da0578cdda.tar perl-software-in-gnu-guix-f496613dd3309a3066642adf1261e9da0578cdda.tar.gz |
improved fragment notes support #1636
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/notes/notes.js | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 46bf5de..44efe15 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -50,10 +50,11 @@ var RevealNotes = (function() { /** * Posts the current slide data to the notes window */ - function post(event) { + function post( event ) { var slideElement = Reveal.getCurrentSlide(), - notesElement = slideElement.querySelector( 'aside.notes' ); + notesElement = slideElement.querySelector( 'aside.notes' ), + fragmentElement = slideElement.querySelector( '.current-fragment' ); var messageData = { namespace: 'reveal-notes', @@ -64,21 +65,27 @@ var RevealNotes = (function() { 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 if( slideElement.hasAttribute( 'data-notes' ) ) { messageData.notes = slideElement.getAttribute( 'data-notes' ); messageData.whitespace = 'pre-wrap'; } + // Look for notes defined in a fragment + if( fragmentElement ) { + var fragmentNotes = fragmentElement.querySelector( 'aside.notes' ); + if( fragmentNotes ) { + notesElement = fragmentNotes; + } + else if( fragmentElement.hasAttribute( 'data-notes' ) ) { + messageData.notes = fragmentElement.getAttribute( 'data-notes' ); + messageData.whitespace = 'pre-wrap'; + + // In case there are slide notes + notesElement = null; + } + } + // Look for notes defined in an aside element if( notesElement ) { messageData.notes = notesElement.innerHTML; |