Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Oct 6, 2023
1 parent d84aa34 commit 1f1ca3a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dist/reveal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js.map

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions js/controllers/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand All @@ -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;
}
Expand Down
12 changes: 10 additions & 2 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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( () => {
Expand All @@ -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 ) {
Expand Down

0 comments on commit 1f1ca3a

Please sign in to comment.