mirror of
https://github.com/hakimel/reveal.js.git
synced 2025-08-05 22:27:37 +02:00
refactoring
This commit is contained in:
2
dist/reveal.esm.js
vendored
2
dist/reveal.esm.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.esm.js.map
vendored
2
dist/reveal.esm.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js
vendored
2
dist/reveal.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js.map
vendored
2
dist/reveal.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -37,12 +37,11 @@ export default class Reader {
|
|||||||
viewportElement.addEventListener( 'scroll', this.onScroll );
|
viewportElement.addEventListener( 'scroll', this.onScroll );
|
||||||
|
|
||||||
let presentationBackground;
|
let presentationBackground;
|
||||||
if( viewportElement ) {
|
|
||||||
const viewportStyles = window.getComputedStyle( viewportElement );
|
const viewportStyles = window.getComputedStyle( viewportElement );
|
||||||
if( viewportStyles && viewportStyles.background ) {
|
if( viewportStyles && viewportStyles.background ) {
|
||||||
presentationBackground = viewportStyles.background;
|
presentationBackground = viewportStyles.background;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const pageElements = [];
|
const pageElements = [];
|
||||||
const pageContainer = slides[0].parentNode;
|
const pageContainer = slides[0].parentNode;
|
||||||
@@ -59,8 +58,7 @@ export default class Reader {
|
|||||||
page.className = 'reader-page';
|
page.className = 'reader-page';
|
||||||
pageElements.push( page );
|
pageElements.push( page );
|
||||||
|
|
||||||
// Copy the presentation-wide background to each individual
|
// Copy the presentation-wide background to each page
|
||||||
// page when printing
|
|
||||||
if( presentationBackground ) {
|
if( presentationBackground ) {
|
||||||
page.style.background = presentationBackground;
|
page.style.background = presentationBackground;
|
||||||
}
|
}
|
||||||
|
12
js/reveal.js
12
js/reveal.js
@@ -214,6 +214,8 @@ export default function( revealElement, options ) {
|
|||||||
// Create slide backgrounds
|
// Create slide backgrounds
|
||||||
backgrounds.update( true );
|
backgrounds.update( true );
|
||||||
|
|
||||||
|
activateInitialView();
|
||||||
|
|
||||||
// Notify listeners that the presentation is ready but use a 1ms
|
// Notify listeners that the presentation is ready but use a 1ms
|
||||||
// timeout to ensure it's not fired synchronously after #initialize()
|
// timeout to ensure it's not fired synchronously after #initialize()
|
||||||
setTimeout( () => {
|
setTimeout( () => {
|
||||||
@@ -232,11 +234,17 @@ export default function( revealElement, options ) {
|
|||||||
});
|
});
|
||||||
}, 1 );
|
}, 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 activatePrintView = config.view === 'print';
|
||||||
const activateReaderView = config.view === 'reader';
|
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 || activateReaderView ) {
|
||||||
|
|
||||||
if( activatePrintView ) {
|
if( activatePrintView ) {
|
||||||
|
Reference in New Issue
Block a user