Jelajahi Sumber

refactoring

Hakim El Hattab 1 tahun lalu
induk
melakukan
1f1ca3a887
6 mengubah file dengan 15 tambahan dan 9 penghapusan
  1. 0 0
      dist/reveal.esm.js
  2. 0 0
      dist/reveal.esm.js.map
  3. 0 0
      dist/reveal.js
  4. 0 0
      dist/reveal.js.map
  5. 5 7
      js/controllers/reader.js
  6. 10 2
      js/reveal.js

File diff ditekan karena terlalu besar
+ 0 - 0
dist/reveal.esm.js


File diff ditekan karena terlalu besar
+ 0 - 0
dist/reveal.esm.js.map


File diff ditekan karena terlalu besar
+ 0 - 0
dist/reveal.js


File diff ditekan karena terlalu besar
+ 0 - 0
dist/reveal.js.map


+ 5 - 7
js/controllers/reader.js

@@ -37,11 +37,10 @@ export default class Reader {
 		viewportElement.addEventListener( 'scroll', this.onScroll );
 
 		let presentationBackground;
-		if( viewportElement ) {
-			const viewportStyles = window.getComputedStyle( viewportElement );
-			if( viewportStyles && viewportStyles.background ) {
-				presentationBackground = viewportStyles.background;
-			}
+
+		const viewportStyles = window.getComputedStyle( viewportElement );
+		if( viewportStyles && viewportStyles.background ) {
+			presentationBackground = viewportStyles.background;
 		}
 
 		const pageElements = [];
@@ -59,8 +58,7 @@ export default class Reader {
 				page.className = 'reader-page';
 				pageElements.push( page );
 
-				// Copy the presentation-wide background to each individual
-				// page when printing
+				// Copy the presentation-wide background to each page
 				if( presentationBackground ) {
 					page.style.background = presentationBackground;
 				}

+ 10 - 2
js/reveal.js

@@ -214,6 +214,8 @@ export default function( revealElement, options ) {
 		// Create slide backgrounds
 		backgrounds.update( true );
 
+		activateInitialView();
+
 		// Notify listeners that the presentation is ready but use a 1ms
 		// timeout to ensure it's not fired synchronously after #initialize()
 		setTimeout( () => {
@@ -232,11 +234,17 @@ export default function( revealElement, options ) {
 			});
 		}, 1 );
 
+	}
+
+	/**
+	 * Activates the correct reveal.js view based on our config.
+	 * This is only invoked once during initialization.
+	 */
+	function activateInitialView() {
+
 		const activatePrintView = config.view === 'print';
 		const activateReaderView = config.view === 'reader';
 
-		// Special setup and config is required when initializing a deck
-		// to be read or printed linearly
 		if( activatePrintView || activateReaderView ) {
 
 			if( activatePrintView ) {

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini