Explorar el Código

'showNotes' does nothing when there are no notes

Hakim El Hattab hace 7 años
padre
commit
0388c96e60
Se han modificado 1 ficheros con 28 adiciones y 4 borrados
  1. 28 4
      js/reveal.js

+ 28 - 4
js/reveal.js

@@ -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();
@@ -2795,6 +2792,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.
 	 */
 	function updateProgress() {