|
@@ -1,7 +1,10 @@
|
|
|
import SlideContent from './controllers/slidecontent.js'
|
|
|
import SlideNumber from './controllers/slidenumber.js'
|
|
|
+import JumpToSlide from './controllers/jumptoslide.js'
|
|
|
import Backgrounds from './controllers/backgrounds.js'
|
|
|
import AutoAnimate from './controllers/autoanimate.js'
|
|
|
+import ScrollView from './controllers/scrollview.js'
|
|
|
+import PrintView from './controllers/printview.js'
|
|
|
import Fragments from './controllers/fragments.js'
|
|
|
import Overview from './controllers/overview.js'
|
|
|
import Keyboard from './controllers/keyboard.js'
|
|
@@ -10,7 +13,6 @@ import Controls from './controllers/controls.js'
|
|
|
import Progress from './controllers/progress.js'
|
|
|
import Pointer from './controllers/pointer.js'
|
|
|
import Plugins from './controllers/plugins.js'
|
|
|
-import Print from './controllers/print.js'
|
|
|
import Touch from './controllers/touch.js'
|
|
|
import Focus from './controllers/focus.js'
|
|
|
import Notes from './controllers/notes.js'
|
|
@@ -26,7 +28,7 @@ import {
|
|
|
} from './utils/constants.js'
|
|
|
|
|
|
// The reveal.js version
|
|
|
-export const VERSION = '4.3.1';
|
|
|
+export const VERSION = '5.0.1';
|
|
|
|
|
|
/**
|
|
|
* reveal.js
|
|
@@ -101,8 +103,11 @@ export default function( revealElement, options ) {
|
|
|
// may be multiple presentations running in parallel.
|
|
|
slideContent = new SlideContent( Reveal ),
|
|
|
slideNumber = new SlideNumber( Reveal ),
|
|
|
+ jumpToSlide = new JumpToSlide( Reveal ),
|
|
|
autoAnimate = new AutoAnimate( Reveal ),
|
|
|
backgrounds = new Backgrounds( Reveal ),
|
|
|
+ scrollView = new ScrollView( Reveal ),
|
|
|
+ printView = new PrintView( Reveal ),
|
|
|
fragments = new Fragments( Reveal ),
|
|
|
overview = new Overview( Reveal ),
|
|
|
keyboard = new Keyboard( Reveal ),
|
|
@@ -111,7 +116,6 @@ export default function( revealElement, options ) {
|
|
|
progress = new Progress( Reveal ),
|
|
|
pointer = new Pointer( Reveal ),
|
|
|
plugins = new Plugins( Reveal ),
|
|
|
- print = new Print( Reveal ),
|
|
|
focus = new Focus( Reveal ),
|
|
|
touch = new Touch( Reveal ),
|
|
|
notes = new Notes( Reveal );
|
|
@@ -138,6 +142,11 @@ export default function( revealElement, options ) {
|
|
|
// 5. Query params
|
|
|
config = { ...defaultConfig, ...config, ...options, ...initOptions, ...Util.getQueryHash() };
|
|
|
|
|
|
+ // Legacy support for the ?print-pdf query
|
|
|
+ if( /print-pdf/gi.test( window.location.search ) ) {
|
|
|
+ config.view = 'print';
|
|
|
+ }
|
|
|
+
|
|
|
setViewport();
|
|
|
|
|
|
// Force a layout when the whole page, incl fonts, has loaded
|
|
@@ -199,12 +208,15 @@ export default function( revealElement, options ) {
|
|
|
// Updates the presentation to match the current configuration values
|
|
|
configure();
|
|
|
|
|
|
- // Read the initial hash
|
|
|
- location.readURL();
|
|
|
-
|
|
|
// Create slide backgrounds
|
|
|
backgrounds.update( true );
|
|
|
|
|
|
+ // Activate the print/scroll view if configured
|
|
|
+ activateInitialView();
|
|
|
+
|
|
|
+ // Read the initial hash
|
|
|
+ location.readURL();
|
|
|
+
|
|
|
// Notify listeners that the presentation is ready but use a 1ms
|
|
|
// timeout to ensure it's not fired synchronously after #initialize()
|
|
|
setTimeout( () => {
|
|
@@ -223,19 +235,41 @@ export default function( revealElement, options ) {
|
|
|
});
|
|
|
}, 1 );
|
|
|
|
|
|
- // Special setup and config is required when printing to PDF
|
|
|
- if( print.isPrintingPDF() ) {
|
|
|
- removeEventListeners();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 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 activateScrollView = config.view === 'scroll' || config.view === 'reader';
|
|
|
|
|
|
- // The document needs to have loaded for the PDF layout
|
|
|
- // measurements to be accurate
|
|
|
- if( document.readyState === 'complete' ) {
|
|
|
- print.setupPDF();
|
|
|
+ if( activatePrintView || activateScrollView ) {
|
|
|
+
|
|
|
+ if( activatePrintView ) {
|
|
|
+ removeEventListeners();
|
|
|
}
|
|
|
else {
|
|
|
- window.addEventListener( 'load', () => {
|
|
|
- print.setupPDF();
|
|
|
- } );
|
|
|
+ touch.unbind();
|
|
|
+ }
|
|
|
+
|
|
|
+ // Avoid content flickering during layout
|
|
|
+ dom.viewport.classList.add( 'loading-scroll-mode' );
|
|
|
+
|
|
|
+ if( activatePrintView ) {
|
|
|
+ // The document needs to have loaded for the PDF layout
|
|
|
+ // measurements to be accurate
|
|
|
+ if( document.readyState === 'complete' ) {
|
|
|
+ printView.activate();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ window.addEventListener( 'load', () => printView.activate() );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ scrollView.activate();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -253,7 +287,18 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
if( !config.showHiddenSlides ) {
|
|
|
Util.queryAll( dom.wrapper, 'section[data-visibility="hidden"]' ).forEach( slide => {
|
|
|
- slide.parentNode.removeChild( slide );
|
|
|
+ const parent = slide.parentNode;
|
|
|
+
|
|
|
+ // If this slide is part of a stack and that stack will be
|
|
|
+ // empty after removing the hidden slide, remove the entire
|
|
|
+ // stack
|
|
|
+ if( parent.childElementCount === 1 && /section/i.test( parent.nodeName ) ) {
|
|
|
+ parent.remove();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ slide.remove();
|
|
|
+ }
|
|
|
+
|
|
|
} );
|
|
|
}
|
|
|
|
|
@@ -278,6 +323,7 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
backgrounds.render();
|
|
|
slideNumber.render();
|
|
|
+ jumpToSlide.render();
|
|
|
controls.render();
|
|
|
progress.render();
|
|
|
notes.render();
|
|
@@ -371,7 +417,7 @@ export default function( revealElement, options ) {
|
|
|
function setupScrollPrevention() {
|
|
|
|
|
|
setInterval( () => {
|
|
|
- if( dom.wrapper.scrollTop !== 0 || dom.wrapper.scrollLeft !== 0 ) {
|
|
|
+ if( !scrollView.isActive() && dom.wrapper.scrollTop !== 0 || dom.wrapper.scrollLeft !== 0 ) {
|
|
|
dom.wrapper.scrollTop = 0;
|
|
|
dom.wrapper.scrollLeft = 0;
|
|
|
}
|
|
@@ -438,8 +484,8 @@ export default function( revealElement, options ) {
|
|
|
dom.wrapper.setAttribute( 'data-background-transition', config.backgroundTransition );
|
|
|
|
|
|
// Expose our configured slide dimensions as custom props
|
|
|
- dom.viewport.style.setProperty( '--slide-width', config.width + 'px' );
|
|
|
- dom.viewport.style.setProperty( '--slide-height', config.height + 'px' );
|
|
|
+ dom.viewport.style.setProperty( '--slide-width', typeof config.width === 'string' ? config.width : config.width + 'px' );
|
|
|
+ dom.viewport.style.setProperty( '--slide-height', typeof config.height === 'string' ? config.height : config.height + 'px' );
|
|
|
|
|
|
if( config.shuffle ) {
|
|
|
shuffle();
|
|
@@ -571,6 +617,7 @@ export default function( revealElement, options ) {
|
|
|
progress.destroy();
|
|
|
backgrounds.destroy();
|
|
|
slideNumber.destroy();
|
|
|
+ jumpToSlide.destroy();
|
|
|
|
|
|
// Remove event listeners
|
|
|
document.removeEventListener( 'fullscreenchange', onFullscreenChange );
|
|
@@ -674,6 +721,26 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Dispatches a slidechanged event.
|
|
|
+ *
|
|
|
+ * @param {string} origin Used to identify multiplex clients
|
|
|
+ */
|
|
|
+ function dispatchSlideChanged( origin ) {
|
|
|
+
|
|
|
+ dispatchEvent({
|
|
|
+ type: 'slidechanged',
|
|
|
+ data: {
|
|
|
+ indexh,
|
|
|
+ indexv,
|
|
|
+ previousSlide,
|
|
|
+ currentSlide,
|
|
|
+ origin
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Dispatched a postMessage of the given type from our window.
|
|
|
*/
|
|
@@ -857,7 +924,10 @@ export default function( revealElement, options ) {
|
|
|
*/
|
|
|
function layout() {
|
|
|
|
|
|
- if( dom.wrapper && !print.isPrintingPDF() ) {
|
|
|
+ if( dom.wrapper && !printView.isActive() ) {
|
|
|
+
|
|
|
+ const viewportWidth = dom.viewport.offsetWidth;
|
|
|
+ const viewportHeight = dom.viewport.offsetHeight;
|
|
|
|
|
|
if( !config.disableLayout ) {
|
|
|
|
|
@@ -871,7 +941,9 @@ export default function( revealElement, options ) {
|
|
|
document.documentElement.style.setProperty( '--vh', ( window.innerHeight * 0.01 ) + 'px' );
|
|
|
}
|
|
|
|
|
|
- const size = getComputedSlideSize();
|
|
|
+ const size = scrollView.isActive() ?
|
|
|
+ getComputedSlideSize( viewportWidth, viewportHeight ) :
|
|
|
+ getComputedSlideSize();
|
|
|
|
|
|
const oldScale = scale;
|
|
|
|
|
@@ -888,8 +960,9 @@ export default function( revealElement, options ) {
|
|
|
scale = Math.max( scale, config.minScale );
|
|
|
scale = Math.min( scale, config.maxScale );
|
|
|
|
|
|
- // Don't apply any scaling styles if scale is 1
|
|
|
- if( scale === 1 ) {
|
|
|
+ // Don't apply any scaling styles if scale is 1 or we're
|
|
|
+ // in the scroll view
|
|
|
+ if( scale === 1 || scrollView.isActive() ) {
|
|
|
dom.slides.style.zoom = '';
|
|
|
dom.slides.style.left = '';
|
|
|
dom.slides.style.top = '';
|
|
@@ -917,7 +990,7 @@ export default function( revealElement, options ) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if( config.center || slide.classList.contains( 'center' ) ) {
|
|
|
+ if( ( config.center || slide.classList.contains( 'center' ) ) ) {
|
|
|
// Vertical stacks are not centred since their section
|
|
|
// children will be
|
|
|
if( slide.classList.contains( 'stack' ) ) {
|
|
@@ -945,7 +1018,13 @@ export default function( revealElement, options ) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ checkResponsiveScrollView();
|
|
|
+
|
|
|
dom.viewport.style.setProperty( '--slide-scale', scale );
|
|
|
+ dom.viewport.style.setProperty( '--viewport-width', viewportWidth + 'px' );
|
|
|
+ dom.viewport.style.setProperty( '--viewport-height', viewportHeight + 'px' );
|
|
|
+
|
|
|
+ scrollView.layout();
|
|
|
|
|
|
progress.update();
|
|
|
backgrounds.updateParallax();
|
|
@@ -966,7 +1045,6 @@ export default function( revealElement, options ) {
|
|
|
* @param {string|number} height
|
|
|
*/
|
|
|
function layoutSlideContents( width, height ) {
|
|
|
-
|
|
|
// Handle sizing of elements with the 'r-stretch' class
|
|
|
Util.queryAll( dom.slides, 'section > .stretch, section > .r-stretch' ).forEach( element => {
|
|
|
|
|
@@ -993,6 +1071,40 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Responsively activates the scroll mode when we reach the configured
|
|
|
+ * activation width.
|
|
|
+ */
|
|
|
+ function checkResponsiveScrollView() {
|
|
|
+
|
|
|
+ // Only proceed if...
|
|
|
+ // 1. The DOM is ready
|
|
|
+ // 2. Layouts aren't disabled via config
|
|
|
+ // 3. We're not currently printing
|
|
|
+ // 4. There is a scrollActivationWidth set
|
|
|
+ // 5. The deck isn't configured to always use the scroll view
|
|
|
+ if(
|
|
|
+ dom.wrapper &&
|
|
|
+ !config.disableLayout &&
|
|
|
+ !printView.isActive() &&
|
|
|
+ typeof config.scrollActivationWidth === 'number' &&
|
|
|
+ config.view !== 'scroll'
|
|
|
+ ) {
|
|
|
+ const size = getComputedSlideSize();
|
|
|
+
|
|
|
+ if( size.presentationWidth > 0 && size.presentationWidth <= config.scrollActivationWidth ) {
|
|
|
+ if( !scrollView.isActive() ) {
|
|
|
+ backgrounds.create();
|
|
|
+ scrollView.activate()
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if( scrollView.isActive() ) scrollView.deactivate();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Calculates the computed pixel size of our slides. These
|
|
|
* values are based on the width and height configuration
|
|
@@ -1003,10 +1115,18 @@ export default function( revealElement, options ) {
|
|
|
*/
|
|
|
function getComputedSlideSize( presentationWidth, presentationHeight ) {
|
|
|
|
|
|
+ let width = config.width;
|
|
|
+ let height = config.height;
|
|
|
+
|
|
|
+ if( config.disableLayout ) {
|
|
|
+ width = dom.slides.offsetWidth;
|
|
|
+ height = dom.slides.offsetHeight;
|
|
|
+ }
|
|
|
+
|
|
|
const size = {
|
|
|
// Slide size
|
|
|
- width: config.width,
|
|
|
- height: config.height,
|
|
|
+ width: width,
|
|
|
+ height: height,
|
|
|
|
|
|
// Presentation size
|
|
|
presentationWidth: presentationWidth || dom.wrapper.offsetWidth,
|
|
@@ -1081,6 +1201,19 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Checks if the current or specified slide is a stack containing
|
|
|
+ * vertical slides.
|
|
|
+ *
|
|
|
+ * @param {HTMLElement} [slide=currentSlide]
|
|
|
+ * @return {Boolean}
|
|
|
+ */
|
|
|
+ function isVerticalStack( slide = currentSlide ) {
|
|
|
+
|
|
|
+ return slide.classList.contains( '.stack' ) || slide.querySelector( 'section' ) !== null;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Returns true if we're on the last slide in the current
|
|
|
* vertical stack.
|
|
@@ -1190,6 +1323,20 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Toggles visibility of the jump-to-slide UI.
|
|
|
+ */
|
|
|
+ function toggleJumpToSlide( override ) {
|
|
|
+
|
|
|
+ if( typeof override === 'boolean' ) {
|
|
|
+ override ? jumpToSlide.show() : jumpToSlide.hide();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ jumpToSlide.isVisible() ? jumpToSlide.hide() : jumpToSlide.show();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Toggles the auto slide mode on and off.
|
|
|
*
|
|
@@ -1233,7 +1380,7 @@ export default function( revealElement, options ) {
|
|
|
*/
|
|
|
function slide( h, v, f, origin ) {
|
|
|
|
|
|
- // Dispatch an event before hte slide
|
|
|
+ // Dispatch an event before the slide
|
|
|
const slidechange = dispatchEvent({
|
|
|
type: 'beforeslidechange',
|
|
|
data: {
|
|
@@ -1252,6 +1399,14 @@ export default function( revealElement, options ) {
|
|
|
// Query all horizontal slides in the deck
|
|
|
const horizontalSlides = dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR );
|
|
|
|
|
|
+ // If we're in scroll mode, we scroll the target slide into view
|
|
|
+ // instead of running our standard slide transition
|
|
|
+ if( scrollView.isActive() ) {
|
|
|
+ const scrollToSlide = scrollView.getSlideByIndices( h, v );
|
|
|
+ if( scrollToSlide ) scrollView.scrollToSlide( scrollToSlide );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// Abort if there are no slides
|
|
|
if( horizontalSlides.length === 0 ) return;
|
|
|
|
|
@@ -1298,6 +1453,9 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
// Detect if we're moving between two auto-animated slides
|
|
|
if( slideChanged && previousSlide && currentSlide && !overview.isActive() ) {
|
|
|
+ transition = 'running';
|
|
|
+
|
|
|
+ autoAnimateTransition = shouldAutoAnimateBetween( previousSlide, currentSlide, indexhBefore, indexvBefore );
|
|
|
|
|
|
// If this is an auto-animated transition, we disable the
|
|
|
// regular slide transition
|
|
@@ -1305,16 +1463,9 @@ export default function( revealElement, options ) {
|
|
|
// Note 20-03-2020:
|
|
|
// This needs to happen before we update slide visibility,
|
|
|
// otherwise transitions will still run in Safari.
|
|
|
- if( previousSlide.hasAttribute( 'data-auto-animate' ) && currentSlide.hasAttribute( 'data-auto-animate' )
|
|
|
- && previousSlide.getAttribute( 'data-auto-animate-id' ) === currentSlide.getAttribute( 'data-auto-animate-id' )
|
|
|
- && !( ( indexh > indexhBefore || indexv > indexvBefore ) ? currentSlide : previousSlide ).hasAttribute( 'data-auto-animate-restart' ) ) {
|
|
|
-
|
|
|
- autoAnimateTransition = true;
|
|
|
- dom.slides.classList.add( 'disable-slide-transitions' );
|
|
|
+ if( autoAnimateTransition ) {
|
|
|
+ dom.slides.classList.add( 'disable-slide-transitions' )
|
|
|
}
|
|
|
-
|
|
|
- transition = 'running';
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// Update the visibility of slides now that the indices have changed
|
|
@@ -1373,16 +1524,7 @@ export default function( revealElement, options ) {
|
|
|
}
|
|
|
|
|
|
if( slideChanged ) {
|
|
|
- dispatchEvent({
|
|
|
- type: 'slidechanged',
|
|
|
- data: {
|
|
|
- indexh,
|
|
|
- indexv,
|
|
|
- previousSlide,
|
|
|
- currentSlide,
|
|
|
- origin
|
|
|
- }
|
|
|
- });
|
|
|
+ dispatchSlideChanged( origin );
|
|
|
}
|
|
|
|
|
|
// Handle embedded content
|
|
@@ -1427,6 +1569,71 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Checks whether or not an auto-animation should take place between
|
|
|
+ * the two given slides.
|
|
|
+ *
|
|
|
+ * @param {HTMLElement} fromSlide
|
|
|
+ * @param {HTMLElement} toSlide
|
|
|
+ * @param {number} indexhBefore
|
|
|
+ * @param {number} indexvBefore
|
|
|
+ *
|
|
|
+ * @returns {boolean}
|
|
|
+ */
|
|
|
+ function shouldAutoAnimateBetween( fromSlide, toSlide, indexhBefore, indexvBefore ) {
|
|
|
+
|
|
|
+ return fromSlide.hasAttribute( 'data-auto-animate' ) && toSlide.hasAttribute( 'data-auto-animate' ) &&
|
|
|
+ fromSlide.getAttribute( 'data-auto-animate-id' ) === toSlide.getAttribute( 'data-auto-animate-id' ) &&
|
|
|
+ !( ( indexh > indexhBefore || indexv > indexvBefore ) ? toSlide : fromSlide ).hasAttribute( 'data-auto-animate-restart' );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Called anytime a new slide should be activated while in the scroll
|
|
|
+ * view. The active slide is the page that occupies the most space in
|
|
|
+ * the scrollable viewport.
|
|
|
+ *
|
|
|
+ * @param {number} pageIndex
|
|
|
+ * @param {HTMLElement} slideElement
|
|
|
+ */
|
|
|
+ function setCurrentScrollPage( slideElement, h, v ) {
|
|
|
+
|
|
|
+ let indexhBefore = indexh || 0;
|
|
|
+
|
|
|
+ indexh = h;
|
|
|
+ indexv = v;
|
|
|
+
|
|
|
+ const slideChanged = currentSlide !== slideElement;
|
|
|
+
|
|
|
+ previousSlide = currentSlide;
|
|
|
+ currentSlide = slideElement;
|
|
|
+
|
|
|
+ if( currentSlide && previousSlide ) {
|
|
|
+ if( config.autoAnimate && shouldAutoAnimateBetween( previousSlide, currentSlide, indexhBefore, indexv ) ) {
|
|
|
+ // Run the auto-animation between our slides
|
|
|
+ autoAnimate.run( previousSlide, currentSlide );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 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 ) );
|
|
|
+ });
|
|
|
+
|
|
|
+ dispatchSlideChanged();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Syncs the presentation with the current DOM. Useful
|
|
|
* when new slides or control elements are added or when
|
|
@@ -1453,7 +1660,9 @@ export default function( revealElement, options ) {
|
|
|
// Write the current hash to the URL
|
|
|
location.writeURL();
|
|
|
|
|
|
- fragments.sortAll();
|
|
|
+ if( config.sortFragmentsOnSync === true ) {
|
|
|
+ fragments.sortAll();
|
|
|
+ }
|
|
|
|
|
|
controls.update();
|
|
|
progress.update();
|
|
@@ -1570,7 +1779,7 @@ export default function( revealElement, options ) {
|
|
|
let slides = Util.queryAll( dom.wrapper, selector ),
|
|
|
slidesLength = slides.length;
|
|
|
|
|
|
- let printMode = print.isPrintingPDF();
|
|
|
+ let printMode = scrollView.isActive() || printView.isActive();
|
|
|
let loopedForwards = false;
|
|
|
let loopedBackwards = false;
|
|
|
|
|
@@ -1682,7 +1891,7 @@ export default function( revealElement, options ) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Shows all fragment elements within the given contaienr.
|
|
|
+ * Shows all fragment elements within the given container.
|
|
|
*/
|
|
|
function showFragmentsIn( container ) {
|
|
|
|
|
@@ -1694,7 +1903,7 @@ export default function( revealElement, options ) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Hides all fragment elements within the given contaienr.
|
|
|
+ * Hides all fragment elements within the given container.
|
|
|
*/
|
|
|
function hideFragmentsIn( container ) {
|
|
|
|
|
@@ -1730,7 +1939,7 @@ export default function( revealElement, options ) {
|
|
|
}
|
|
|
|
|
|
// All slides need to be visible when exporting to PDF
|
|
|
- if( print.isPrintingPDF() ) {
|
|
|
+ if( printView.isActive() ) {
|
|
|
viewDistance = Number.MAX_VALUE;
|
|
|
}
|
|
|
|
|
@@ -1834,7 +2043,7 @@ export default function( revealElement, options ) {
|
|
|
}
|
|
|
|
|
|
// If includeFragments is set, a route will be considered
|
|
|
- // availalbe if either a slid OR fragment is available in
|
|
|
+ // available if either a slid OR fragment is available in
|
|
|
// the given direction
|
|
|
if( includeFragments === true ) {
|
|
|
let fragmentRoutes = fragments.availableRoutes();
|
|
@@ -1961,21 +2170,31 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
// If a slide is specified, return the indices of that slide
|
|
|
if( slide ) {
|
|
|
- let isVertical = isVerticalSlide( slide );
|
|
|
- let slideh = isVertical ? slide.parentNode : slide;
|
|
|
+ // In scroll mode the original h/x index is stored on the slide
|
|
|
+ if( scrollView.isActive() ) {
|
|
|
+ h = parseInt( slide.getAttribute( 'data-index-h' ), 10 );
|
|
|
|
|
|
- // Select all horizontal slides
|
|
|
- let horizontalSlides = getHorizontalSlides();
|
|
|
+ if( slide.getAttribute( 'data-index-v' ) ) {
|
|
|
+ v = parseInt( slide.getAttribute( 'data-index-v' ), 10 );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ let isVertical = isVerticalSlide( slide );
|
|
|
+ let slideh = isVertical ? slide.parentNode : slide;
|
|
|
|
|
|
- // Now that we know which the horizontal slide is, get its index
|
|
|
- h = Math.max( horizontalSlides.indexOf( slideh ), 0 );
|
|
|
+ // Select all horizontal slides
|
|
|
+ let horizontalSlides = getHorizontalSlides();
|
|
|
|
|
|
- // Assume we're not vertical
|
|
|
- v = undefined;
|
|
|
+ // Now that we know which the horizontal slide is, get its index
|
|
|
+ h = Math.max( horizontalSlides.indexOf( slideh ), 0 );
|
|
|
|
|
|
- // If this is a vertical slide, grab the vertical index
|
|
|
- if( isVertical ) {
|
|
|
- v = Math.max( Util.queryAll( slide.parentNode, 'section' ).indexOf( slide ), 0 );
|
|
|
+ // Assume we're not vertical
|
|
|
+ v = undefined;
|
|
|
+
|
|
|
+ // If this is a vertical slide, grab the vertical index
|
|
|
+ if( isVertical ) {
|
|
|
+ v = Math.max( Util.queryAll( slide.parentNode, 'section' ).indexOf( slide ), 0 );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2176,11 +2395,7 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
if( currentSlide && config.autoSlide !== false ) {
|
|
|
|
|
|
- let fragment = currentSlide.querySelector( '.current-fragment' );
|
|
|
-
|
|
|
- // When the slide first appears there is no "current" fragment so
|
|
|
- // we look for a data-autoslide timing on the first fragment
|
|
|
- if( !fragment ) fragment = currentSlide.querySelector( '.fragment' );
|
|
|
+ let fragment = currentSlide.querySelector( '.current-fragment[data-autoslide]' );
|
|
|
|
|
|
let fragmentAutoSlide = fragment ? fragment.getAttribute( 'data-autoslide' ) : null;
|
|
|
let parentAutoSlide = currentSlide.parentNode ? currentSlide.parentNode.getAttribute( 'data-autoslide' ) : null;
|
|
@@ -2284,6 +2499,9 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
navigationHistory.hasNavigatedHorizontally = true;
|
|
|
|
|
|
+ // Scroll view navigation is handled independently
|
|
|
+ if( scrollView.isActive() ) return scrollView.prev();
|
|
|
+
|
|
|
// Reverse for RTL
|
|
|
if( config.rtl ) {
|
|
|
if( ( overview.isActive() || skipFragments || fragments.next() === false ) && availableRoutes().left ) {
|
|
@@ -2301,6 +2519,9 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
navigationHistory.hasNavigatedHorizontally = true;
|
|
|
|
|
|
+ // Scroll view navigation is handled independently
|
|
|
+ if( scrollView.isActive() ) return scrollView.next();
|
|
|
+
|
|
|
// Reverse for RTL
|
|
|
if( config.rtl ) {
|
|
|
if( ( overview.isActive() || skipFragments || fragments.prev() === false ) && availableRoutes().right ) {
|
|
@@ -2316,6 +2537,9 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
function navigateUp({skipFragments=false}={}) {
|
|
|
|
|
|
+ // Scroll view navigation is handled independently
|
|
|
+ if( scrollView.isActive() ) return scrollView.prev();
|
|
|
+
|
|
|
// Prioritize hiding fragments
|
|
|
if( ( overview.isActive() || skipFragments || fragments.prev() === false ) && availableRoutes().up ) {
|
|
|
slide( indexh, indexv - 1 );
|
|
@@ -2327,6 +2551,9 @@ export default function( revealElement, options ) {
|
|
|
|
|
|
navigationHistory.hasNavigatedVertically = true;
|
|
|
|
|
|
+ // Scroll view navigation is handled independently
|
|
|
+ if( scrollView.isActive() ) return scrollView.next();
|
|
|
+
|
|
|
// Prioritize revealing fragments
|
|
|
if( ( overview.isActive() || skipFragments || fragments.next() === false ) && availableRoutes().down ) {
|
|
|
slide( indexh, indexv + 1 );
|
|
@@ -2342,6 +2569,9 @@ export default function( revealElement, options ) {
|
|
|
*/
|
|
|
function navigatePrev({skipFragments=false}={}) {
|
|
|
|
|
|
+ // Scroll view navigation is handled independently
|
|
|
+ if( scrollView.isActive() ) return scrollView.prev();
|
|
|
+
|
|
|
// Prioritize revealing fragments
|
|
|
if( skipFragments || fragments.prev() === false ) {
|
|
|
if( availableRoutes().up ) {
|
|
@@ -2381,6 +2611,9 @@ export default function( revealElement, options ) {
|
|
|
navigationHistory.hasNavigatedHorizontally = true;
|
|
|
navigationHistory.hasNavigatedVertically = true;
|
|
|
|
|
|
+ // Scroll view navigation is handled independently
|
|
|
+ if( scrollView.isActive() ) return scrollView.next();
|
|
|
+
|
|
|
// Prioritize revealing fragments
|
|
|
if( skipFragments || fragments.next() === false ) {
|
|
|
|
|
@@ -2509,7 +2742,6 @@ export default function( revealElement, options ) {
|
|
|
function onWindowResize( event ) {
|
|
|
|
|
|
layout();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2652,17 +2884,24 @@ export default function( revealElement, options ) {
|
|
|
// Toggles the overview mode on/off
|
|
|
toggleOverview: overview.toggle.bind( overview ),
|
|
|
|
|
|
+ // Toggles the scroll view on/off
|
|
|
+ toggleScrollView: scrollView.toggle.bind( scrollView ),
|
|
|
+
|
|
|
// Toggles the "black screen" mode on/off
|
|
|
togglePause,
|
|
|
|
|
|
// Toggles the auto slide mode on/off
|
|
|
toggleAutoSlide,
|
|
|
|
|
|
+ // Toggles visibility of the jump-to-slide UI
|
|
|
+ toggleJumpToSlide,
|
|
|
+
|
|
|
// Slide navigation checks
|
|
|
isFirstSlide,
|
|
|
isLastSlide,
|
|
|
isLastVerticalSlide,
|
|
|
isVerticalSlide,
|
|
|
+ isVerticalStack,
|
|
|
|
|
|
// State checks
|
|
|
isPaused,
|
|
@@ -2670,7 +2909,9 @@ export default function( revealElement, options ) {
|
|
|
isSpeakerNotes: notes.isSpeakerNotesWindow.bind( notes ),
|
|
|
isOverview: overview.isActive.bind( overview ),
|
|
|
isFocused: focus.isFocused.bind( focus ),
|
|
|
- isPrintingPDF: print.isPrintingPDF.bind( print ),
|
|
|
+
|
|
|
+ isScrollView: scrollView.isActive.bind( scrollView ),
|
|
|
+ isPrintView: printView.isActive.bind( printView ),
|
|
|
|
|
|
// Checks if reveal.js has been loaded and is ready for use
|
|
|
isReady: () => ready,
|
|
@@ -2679,6 +2920,10 @@ export default function( revealElement, options ) {
|
|
|
loadSlide: slideContent.load.bind( slideContent ),
|
|
|
unloadSlide: slideContent.unload.bind( slideContent ),
|
|
|
|
|
|
+ // Media playback
|
|
|
+ startEmbeddedContent: () => slideContent.startEmbeddedContent( currentSlide ),
|
|
|
+ stopEmbeddedContent: () => slideContent.stopEmbeddedContent( currentSlide, { unloadIframes: false } ),
|
|
|
+
|
|
|
// Preview management
|
|
|
showPreview,
|
|
|
hidePreview: closeOverlay,
|
|
@@ -2739,6 +2984,8 @@ export default function( revealElement, options ) {
|
|
|
hasNavigatedHorizontally: () => navigationHistory.hasNavigatedHorizontally,
|
|
|
hasNavigatedVertically: () => navigationHistory.hasNavigatedVertically,
|
|
|
|
|
|
+ shouldAutoAnimateBetween,
|
|
|
+
|
|
|
// Adds/removes a custom key binding
|
|
|
addKeyBinding: keyboard.addKeyBinding.bind( keyboard ),
|
|
|
removeKeyBinding: keyboard.removeKeyBinding.bind( keyboard ),
|
|
@@ -2750,6 +2997,7 @@ export default function( revealElement, options ) {
|
|
|
registerKeyboardShortcut: keyboard.registerKeyboardShortcut.bind( keyboard ),
|
|
|
|
|
|
getComputedSlideSize,
|
|
|
+ setCurrentScrollPage,
|
|
|
|
|
|
// Returns the current scale of the presentation content
|
|
|
getScale: () => scale,
|
|
@@ -2786,13 +3034,14 @@ export default function( revealElement, options ) {
|
|
|
getStatusText,
|
|
|
|
|
|
// Controllers
|
|
|
- print,
|
|
|
focus,
|
|
|
+ scroll: scrollView,
|
|
|
progress,
|
|
|
controls,
|
|
|
location,
|
|
|
overview,
|
|
|
fragments,
|
|
|
+ backgrounds,
|
|
|
slideContent,
|
|
|
slideNumber,
|
|
|
|