fix: pdf page numbering for fragment group

edit
Chi Vong 2022-04-02 18:59:46 +02:00
parent e281b3234e
commit 953aaad83a
5 changed files with 10 additions and 6 deletions

2
dist/reveal.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/reveal.js vendored

File diff suppressed because one or more lines are too long

2
dist/reveal.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -66,6 +66,7 @@ export default class Print {
const pages = [];
const pageContainer = slides[0].parentNode;
let slideNumber = 1;
// Slide and slide background layout
slides.forEach( function( slide, index ) {
@ -148,11 +149,11 @@ export default class Print {
// Inject slide numbers if `slideNumbers` are enabled
if( doingSlideNumbers ) {
const slideNumber = index + 1;
const numberElement = document.createElement( 'div' );
numberElement.classList.add( 'slide-number' );
numberElement.classList.add( 'slide-number-pdf' );
numberElement.innerHTML = slideNumber;
slideNumber++;
page.appendChild( numberElement );
}
@ -166,7 +167,7 @@ export default class Print {
let previousFragmentStep;
fragmentGroups.forEach( function( fragments ) {
fragmentGroups.forEach( function( fragments, index ) {
// Remove 'current-fragment' from the previous group
if( previousFragmentStep ) {
@ -182,6 +183,9 @@ export default class Print {
// Create a separate page for the current fragment state
const clonedPage = page.cloneNode( true );
const numberElement = clonedPage.querySelector( '.slide-number-pdf' );
const fragmentNumber = index + 1;
numberElement.innerHTML = numberElement.innerHTML + "." + fragmentNumber;
pages.push( clonedPage );
previousFragmentStep = fragments;