major cleanup of reader mode code
This commit is contained in:
14
js/reveal.js
14
js/reveal.js
@@ -1578,6 +1578,8 @@ export default function( revealElement, options ) {
|
||||
indexh = h;
|
||||
indexv = v;
|
||||
|
||||
const slideChanged = currentSlide !== slideElement;
|
||||
|
||||
previousSlide = currentSlide;
|
||||
currentSlide = slideElement;
|
||||
|
||||
@@ -1588,6 +1590,17 @@ export default function( revealElement, options ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Start or stop embedded content like videos and iframes
|
||||
if( slideChanged ) {
|
||||
if( previousSlide ) {
|
||||
slideContent.stopEmbeddedContent( previousSlide );
|
||||
slideContent.stopEmbeddedContent( previousSlide.slideBackgroundElement );
|
||||
}
|
||||
|
||||
slideContent.startEmbeddedContent( currentSlide );
|
||||
slideContent.startEmbeddedContent( currentSlide.slideBackgroundElement );
|
||||
}
|
||||
|
||||
requestAnimationFrame( () => {
|
||||
announceStatus( getStatusText( currentSlide ) );
|
||||
});
|
||||
@@ -2132,6 +2145,7 @@ export default function( revealElement, options ) {
|
||||
|
||||
// If a slide is specified, return the indices of that slide
|
||||
if( slide ) {
|
||||
// In reader mode the original h/x index is stored on the slide
|
||||
if( reader.isActive() ) {
|
||||
h = parseInt( slide.getAttribute( 'data-index-h' ), 10 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user