'showNotes' does nothing when there are no notes

This commit is contained in:
Hakim El Hattab 2017-05-24 10:05:16 +02:00
parent 53c56510ed
commit 0388c96e60
1 changed files with 28 additions and 4 deletions

View File

@ -1051,12 +1051,8 @@
}
if( config.showNotes ) {
dom.wrapper.classList.add( 'show-notes' );
dom.speakerNotes.setAttribute( 'data-layout', typeof config.showNotes === 'string' ? config.showNotes : 'inline' );
}
else {
dom.wrapper.classList.remove( 'show-notes' );
}
if( config.mouseWheel ) {
document.addEventListener( 'DOMMouseScroll', onDocumentMouseScroll, false ); // FF
@ -2489,6 +2485,7 @@
updateSlideNumber();
updateSlidesVisibility();
updateBackground( true );
updateNotesVisibility();
updateNotes();
formatEmbeddedContent();
@ -2794,6 +2791,33 @@
}
/**
* Updates the visibility of the speaker notes sidebar that
* is used to share annotated slides. The notes sidebar is
* only visible if showNotes is true and there are notes on
* one or more slides in the deck.
*/
function updateNotesVisibility() {
if( config.showNotes && hasNotes() ) {
dom.wrapper.classList.add( 'show-notes' );
}
else {
dom.wrapper.classList.remove( 'show-notes' );
}
}
/**
* Checks if there are speaker notes for ANY slide in the
* presentation.
*/
function hasNotes() {
return dom.slides.querySelectorAll( '[data-notes], aside.notes' ).length > 0;
}
/**
* Updates the progress bar to reflect the current slide.
*/