* Posts the current slide data to the notes window
()
| 46 | * Posts the current slide data to the notes window |
| 47 | */ |
| 48 | function post() { |
| 49 | |
| 50 | var slideElement = Reveal.getCurrentSlide(), |
| 51 | notesElement = slideElement.querySelector( 'aside.notes' ); |
| 52 | |
| 53 | var messageData = { |
| 54 | namespace: 'reveal-notes', |
| 55 | type: 'state', |
| 56 | notes: '', |
| 57 | markdown: false, |
| 58 | whitespace: 'normal', |
| 59 | state: Reveal.getState() |
| 60 | }; |
| 61 | |
| 62 | // Look for notes defined in a slide attribute |
| 63 | if( slideElement.hasAttribute( 'data-notes' ) ) { |
| 64 | messageData.notes = slideElement.getAttribute( 'data-notes' ); |
| 65 | messageData.whitespace = 'pre-wrap'; |
| 66 | } |
| 67 | |
| 68 | // Look for notes defined in an aside element |
| 69 | if( notesElement ) { |
| 70 | messageData.notes = notesElement.innerHTML; |
| 71 | messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string'; |
| 72 | } |
| 73 | |
| 74 | notesPopup.postMessage( JSON.stringify( messageData ), '*' ); |
| 75 | |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Called once we have established a connection to the notes |