mirror of
https://github.com/hakimel/reveal.js.git
synced 2025-08-11 00:55:01 +02:00
reader mode tests
This commit is contained in:
@@ -311,7 +311,7 @@ export default {
|
||||
// Time before the cursor is hidden (in ms)
|
||||
hideCursorTime: 5000,
|
||||
|
||||
// Should we automatmically sort and set indices for fragments
|
||||
// Should we automatically sort and set indices for fragments
|
||||
// at each sync? (See Reveal.sync)
|
||||
sortFragmentsOnSync: true,
|
||||
|
||||
|
@@ -22,7 +22,7 @@ export default class Reader {
|
||||
* Activates the reader mode. This rearranges the presentation DOM
|
||||
* by—among other things—wrapping each slide in a page element.
|
||||
*/
|
||||
async activate() {
|
||||
activate() {
|
||||
|
||||
if( this.active ) return;
|
||||
|
||||
@@ -89,8 +89,6 @@ export default class Reader {
|
||||
// Remove leftover stacks
|
||||
queryAll( this.Reveal.getRevealElement(), '.stack' ).forEach( stack => stack.remove() );
|
||||
|
||||
await new Promise( requestAnimationFrame );
|
||||
|
||||
pageElements.forEach( page => pageContainer.appendChild( page ) );
|
||||
|
||||
// Re-run JS-based content layout after the slide is added to page DOM
|
||||
@@ -128,13 +126,13 @@ export default class Reader {
|
||||
|
||||
}
|
||||
|
||||
toggle() {
|
||||
toggle( override ) {
|
||||
|
||||
if( this.active === true ) {
|
||||
this.deactivate();
|
||||
if( typeof override === 'boolean' ) {
|
||||
override ? this.activate() : this.deactivate();
|
||||
}
|
||||
else {
|
||||
this.activate();
|
||||
this.isActive() ? this.deactivate() : this.activate();
|
||||
}
|
||||
|
||||
}
|
||||
|
20
js/reveal.js
20
js/reveal.js
@@ -249,24 +249,18 @@ export default function( revealElement, options ) {
|
||||
// Avoid content flickering during layout
|
||||
dom.viewport.classList.add( 'loading-scroll-mode' );
|
||||
|
||||
const activate = () => {
|
||||
if( activatePrintView ) {
|
||||
if( activatePrintView ) {
|
||||
// The document needs to have loaded for the PDF layout
|
||||
// measurements to be accurate
|
||||
if( document.readyState === 'complete' ) {
|
||||
print.activate();
|
||||
}
|
||||
else {
|
||||
reader.activate();
|
||||
window.addEventListener( 'load', () => print.activate() );
|
||||
}
|
||||
};
|
||||
|
||||
// The document needs to have loaded for the PDF layout
|
||||
// measurements to be accurate
|
||||
if( document.readyState === 'complete' ) {
|
||||
activate();
|
||||
}
|
||||
else {
|
||||
window.addEventListener( 'load', () => {
|
||||
activate();
|
||||
} );
|
||||
reader.activate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2784,7 +2778,7 @@ export default function( revealElement, options ) {
|
||||
toggleOverview: overview.toggle.bind( overview ),
|
||||
|
||||
// Toggles the reader mode on/off
|
||||
toggleReader: reader.toggle.bind( reader ),
|
||||
toggleReaderMode: reader.toggle.bind( reader ),
|
||||
|
||||
// Toggles the "black screen" mode on/off
|
||||
togglePause,
|
||||
|
Reference in New Issue
Block a user