merge #1955 with minor changes
This commit is contained in:
parent
a86146180f
commit
3680f1ad10
|
@ -78,6 +78,7 @@ module.exports = function(grunt) {
|
||||||
eqnull: true,
|
eqnull: true,
|
||||||
browser: true,
|
browser: true,
|
||||||
expr: true,
|
expr: true,
|
||||||
|
loopfunc: true,
|
||||||
globals: {
|
globals: {
|
||||||
head: false,
|
head: false,
|
||||||
module: false,
|
module: false,
|
||||||
|
|
|
@ -947,6 +947,11 @@ Reveal.initialize({
|
||||||
Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome) or [Chromium](https://www.chromium.org/Home) and to be serving the presentation from a webserver.
|
Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome) or [Chromium](https://www.chromium.org/Home) and to be serving the presentation from a webserver.
|
||||||
Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-300.
|
Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-300.
|
||||||
|
|
||||||
|
### Separate pages for fragments
|
||||||
|
[Fragments](#fragments) are printed on separate slides by default. Meaning if you have a slide with three fragment steps, it will generate three separate slides where the fragments appear incrementally.
|
||||||
|
|
||||||
|
If you prefer printing all fragments in their visible states on the same slide you can set the `pdfSeparateFragments` config option to false.
|
||||||
|
|
||||||
### Page size
|
### Page size
|
||||||
|
|
||||||
Export dimensions are inferred from the configured [presentation size](#presentation-size). Slides that are too tall to fit within a single page will expand onto multiple pages. You can limit how many pages a slide may expand onto using the `pdfMaxPagesPerSlide` config option, for example `Reveal.configure({ pdfMaxPagesPerSlide: 1 })` ensures that no slide ever grows to more than one printed page.
|
Export dimensions are inferred from the configured [presentation size](#presentation-size). Slides that are too tall to fit within a single page will expand onto multiple pages. You can limit how many pages a slide may expand onto using the `pdfMaxPagesPerSlide` config option, for example `Reveal.configure({ pdfMaxPagesPerSlide: 1 })` ensures that no slide ever grows to more than one printed page.
|
||||||
|
|
23
js/reveal.js
23
js/reveal.js
|
@ -204,6 +204,9 @@
|
||||||
// to PDF, unlimited by default
|
// to PDF, unlimited by default
|
||||||
pdfMaxPagesPerSlide: Number.POSITIVE_INFINITY,
|
pdfMaxPagesPerSlide: Number.POSITIVE_INFINITY,
|
||||||
|
|
||||||
|
// Prints each fragment on a separate slide
|
||||||
|
pdfSeparateFragments: true,
|
||||||
|
|
||||||
// Offset used to reduce the height of content within exported PDF pages.
|
// Offset used to reduce the height of content within exported PDF pages.
|
||||||
// This exists to account for environment differences based on how you
|
// This exists to account for environment differences based on how you
|
||||||
// print to PDF. CLI printing options, like phantomjs and wkpdf, can end
|
// print to PDF. CLI printing options, like phantomjs and wkpdf, can end
|
||||||
|
@ -789,29 +792,38 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy page and show fragments one after another
|
// Copy page and show fragments one after another
|
||||||
if ( isPrintingPDFFragments() ) {
|
if( config.pdfSeparateFragments ) {
|
||||||
|
|
||||||
var numberOfFragments = toArray( page.querySelectorAll( '.fragment' ) ).length;
|
var numberOfFragments = toArray( page.querySelectorAll( '.fragment' ) ).length;
|
||||||
|
|
||||||
for( var currentFragment = 0; currentFragment < numberOfFragments; currentFragment++ ) {
|
for( var currentFragment = 0; currentFragment < numberOfFragments; currentFragment++ ) {
|
||||||
|
|
||||||
var clonedPage = page.cloneNode( true );
|
var clonedPage = page.cloneNode( true );
|
||||||
page.parentNode.insertBefore( clonedPage, page.nextSibling );
|
page.parentNode.insertBefore( clonedPage, page.nextSibling );
|
||||||
|
|
||||||
toArray( sortFragments( clonedPage.querySelectorAll( '.fragment' ) ) ).forEach( function( fragment, fragmentIndex ) {
|
toArray( sortFragments( clonedPage.querySelectorAll( '.fragment' ) ) ).forEach( function( fragment, fragmentIndex ) {
|
||||||
if ( fragmentIndex <= currentFragment ) {
|
|
||||||
|
if( fragmentIndex < currentFragment ) {
|
||||||
fragment.classList.add( 'visible' );
|
fragment.classList.add( 'visible' );
|
||||||
} else {
|
fragment.classList.remove( 'current-fragment' );
|
||||||
fragment.classList.remove( 'visible' );
|
|
||||||
}
|
}
|
||||||
|
else if( fragmentIndex === currentFragment ) {
|
||||||
|
fragment.classList.add( 'visible', 'current-fragment' );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fragment.classList.remove( 'visible', 'current-fragment' );
|
||||||
|
}
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
page = clonedPage;
|
page = clonedPage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Show all fragments
|
// Show all fragments
|
||||||
else {
|
else {
|
||||||
toArray( page.querySelectorAll( '.fragment' ) ).forEach( function( fragment ) {
|
toArray( page.querySelectorAll( '.fragment:not(.fade-out)' ) ).forEach( function( fragment ) {
|
||||||
fragment.classList.add( 'visible' );
|
fragment.classList.add( 'visible' );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -820,7 +832,6 @@
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
// Notify subscribers that the PDF layout is good to go
|
// Notify subscribers that the PDF layout is good to go
|
||||||
dispatchEvent( 'pdf-ready' );
|
dispatchEvent( 'pdf-ready' );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue