merge support for multiple notes on same slide
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -108,7 +108,7 @@ const Plugin = () => {
|
||||
function post( event ) {
|
||||
|
||||
let slideElement = deck.getCurrentSlide(),
|
||||
notesElement = slideElement.querySelector( 'aside.notes' ),
|
||||
notesElements = slideElement.querySelectorAll( 'aside.notes' ),
|
||||
fragmentElement = slideElement.querySelector( '.current-fragment' );
|
||||
|
||||
let messageData = {
|
||||
@ -130,21 +130,25 @@ const Plugin = () => {
|
||||
if( fragmentElement ) {
|
||||
let fragmentNotes = fragmentElement.querySelector( 'aside.notes' );
|
||||
if( fragmentNotes ) {
|
||||
notesElement = fragmentNotes;
|
||||
messageData.notes = fragmentNotes.innerHTML;
|
||||
messageData.markdown = typeof fragmentNotes.getAttribute( 'data-markdown' ) === 'string';
|
||||
|
||||
// Ignore other slide notes
|
||||
notesElements = null;
|
||||
}
|
||||
else if( fragmentElement.hasAttribute( 'data-notes' ) ) {
|
||||
messageData.notes = fragmentElement.getAttribute( 'data-notes' );
|
||||
messageData.whitespace = 'pre-wrap';
|
||||
|
||||
// In case there are slide notes
|
||||
notesElement = null;
|
||||
notesElements = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Look for notes defined in an aside element
|
||||
if( notesElement ) {
|
||||
messageData.notes = notesElement.innerHTML;
|
||||
messageData.markdown = typeof notesElement.getAttribute( 'data-markdown' ) === 'string';
|
||||
if( notesElements ) {
|
||||
messageData.notes = Array.from(notesElements).map( notesElement => notesElement.innerHTML ).join( '\n' );
|
||||
messageData.markdown = typeof notesElements[0].getAttribute( 'data-markdown' ) === 'string';
|
||||
}
|
||||
|
||||
speakerWindow.postMessage( JSON.stringify( messageData ), '*' );
|
||||
|
Reference in New Issue
Block a user