reader mode can be turned off without reload, add Reveal.toggleReader()

This commit is contained in:
Hakim El Hattab
2023-09-19 11:52:54 +02:00
parent 4da6f6b30f
commit 5de7da7692
9 changed files with 61 additions and 27 deletions

View File

@@ -228,7 +228,7 @@ export default function( revealElement, options ) {
}, 1 );
const isPrintMode = print.isActive();
const isReaderMode = reader.isActive();
const isReaderMode = config.mode === 'reader';
// Special setup and config is required when initializing a deck
// to be read or printed linearly
@@ -238,12 +238,11 @@ export default function( revealElement, options ) {
removeEventListeners();
}
else {
keyboard.unbind();
touch.unbind();
}
// Avoid content flickering during layout
revealElement.style.visibility = 'hidden';
dom.viewport.classList.add( 'loading-scroll-mode' );
const activate = () => {
if( isPrintMode ) {
@@ -2722,6 +2721,9 @@ export default function( revealElement, options ) {
// Toggles the overview mode on/off
toggleOverview: overview.toggle.bind( overview ),
// Toggles the reader mode on/off
toggleReader: reader.toggle.bind( reader ),
// Toggles the "black screen" mode on/off
togglePause,