Преглед на файлове

rename 'mode' config value to 'view'

Hakim El Hattab преди 1 година
родител
ревизия
f0950ba9ae
променени са 8 файла, в които са добавени 15 реда и са изтрити 15 реда
  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. 2 2
      js/config.js
  6. 2 2
      js/controllers/notes.js
  7. 1 6
      js/controllers/print.js
  8. 10 5
      js/reveal.js

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/reveal.esm.js


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/reveal.esm.js.map


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/reveal.js


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
dist/reveal.js.map


+ 2 - 2
js/config.js

@@ -256,11 +256,11 @@ export default {
 	parallaxBackgroundHorizontal: null,
 	parallaxBackgroundVertical: null,
 
-	// Can be used to initialize reveal.js in one of the following modes:
+	// Can be used to initialize reveal.js in one of the following views:
 	// - print:   Render the presentation so that it can be printed to PDF
 	// - reader:  Show the presentation as a tall scrollable page with scroll
 	//            triggered animations
-	mode: null,
+	view: null,
 
 	// When the presentation is in reader mode, this controls whether each
 	// page should be as tall as the presentation viewport. Set this to false

+ 2 - 2
js/controllers/notes.js

@@ -41,7 +41,7 @@ export default class Notes {
 		if( this.Reveal.getConfig().showNotes &&
 			this.element && this.Reveal.getCurrentSlide() &&
 			!this.Reveal.isReaderMode() &&
-			!this.Reveal.isPrintMode()
+			!this.Reveal.isPrinting()
 		) {
 			this.element.innerHTML = this.getSlideNotes() || '<span class="notes-placeholder">No notes on this slide.</span>';
 		}
@@ -59,7 +59,7 @@ export default class Notes {
 		if( this.Reveal.getConfig().showNotes &&
 			this.hasNotes() &&
 			!this.Reveal.isReaderMode() &&
-			!this.Reveal.isPrintMode()
+			!this.Reveal.isPrinting()
 		) {
 			this.Reveal.getRevealElement().classList.add( 'show-notes' );
 		}

+ 1 - 6
js/controllers/print.js

@@ -230,12 +230,7 @@ export default class Print {
 	 */
 	isActive() {
 
-		if( typeof this._isPrintMode === 'undefined' ) {
-			this._isPrintMode = this.Reveal.getConfig().mode === 'pdf' ||
-								( /print-pdf/gi ).test( window.location.search );
-		}
-
-		return this._isPrintMode;
+		return this.Reveal.getConfig().view === 'print';
 
 	}
 

+ 10 - 5
js/reveal.js

@@ -142,6 +142,11 @@ export default function( revealElement, options ) {
 		// 5. Query params
 		config = { ...defaultConfig, ...config, ...options, ...initOptions, ...Util.getQueryHash() };
 
+		// Legacy support for the ?print-pdf query
+		if( /print-pdf/gi.test( window.location.search ) ) {
+			config.view = 'print';
+		}
+
 		setViewport();
 
 		// Force a layout when the whole page, incl fonts, has loaded
@@ -227,14 +232,14 @@ export default function( revealElement, options ) {
 			});
 		}, 1 );
 
-		const isPrintMode = print.isActive();
-		const isReaderMode = config.mode === 'reader';
+		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( isPrintMode || isReaderMode ) {
+		if( activatePrintView || activateReaderView ) {
 
-			if( isPrintMode ) {
+			if( activatePrintView ) {
 				removeEventListeners();
 			}
 			else {
@@ -245,7 +250,7 @@ export default function( revealElement, options ) {
 			dom.viewport.classList.add( 'loading-scroll-mode' );
 
 			const activate = () => {
-				if( isPrintMode ) {
+				if( activatePrintView ) {
 					print.activate();
 				}
 				else {

Някои файлове не бяха показани, защото твърде много файлове са промени