File tree Expand file tree Collapse file tree 4 files changed +16
-13
lines changed
packages/spectacle/src/components Expand file tree Collapse file tree 4 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' spectacle ' : patch
3+ ---
4+
5+ Fix print mode not showing content for Markdown and Animated item slides.
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { ReactNode, useContext } from 'react';
22import { animated , useSpring } from 'react-spring' ;
33import { useSteps } from '../hooks/use-steps' ;
44import { SlideContext } from './slide/slide' ;
5+ import { DeckContext } from './deck/deck' ;
56
67const SteppedComponent = ( props : SteppedComponentProps ) : JSX . Element => {
78 const {
@@ -17,6 +18,8 @@ const SteppedComponent = (props: SteppedComponentProps): JSX.Element => {
1718 inactiveStyle = { opacity : '0' }
1819 } = props ;
1920 const slideContext = useContext ( SlideContext ) ;
21+ const { inPrintMode, inOverviewMode } = useContext ( DeckContext ) ;
22+
2023 if ( slideContext === null ) {
2124 throw new Error (
2225 'This component must be used within a SlideContext.Provider. Did you' +
@@ -51,7 +54,7 @@ const SteppedComponent = (props: SteppedComponentProps): JSX.Element => {
5154 { placeholder }
5255 < AnimatedEl
5356 style = {
54- alwaysAppearActive
57+ alwaysAppearActive || inPrintMode || inOverviewMode
5558 ? ( activeStyle as React . CSSProperties )
5659 : springStyle
5760 }
Original file line number Diff line number Diff line change @@ -86,10 +86,10 @@ DeckContext.displayName = 'DeckContext';
8686const noop = ( ) => { } ;
8787
8888/**
89- * The PDF DPI is 96. We want to scale the slide down because it's a 1:1 px to 1/100th of an inch.
90- * However there are some unchangeable margins that make 0.96 too big, so we use 0.959 to prevent overflow .
89+ * By default, Spectacle will maintain a 100% zoom on print/export mode. This can be customized if the
90+ * user wants to select a different paper size .
9191 */
92- const DEFAULT_PRINT_SCALE = 0.959 ;
92+ const DEFAULT_PRINT_SCALE = 1.0 ;
9393const DEFAULT_OVERVIEW_SCALE = 0.25 ;
9494
9595type PortalProps = {
Original file line number Diff line number Diff line change @@ -10,15 +10,14 @@ const Backdrop = styled.div`
1010 background-color: white;
1111` ;
1212
13- type PrintStyleProps = { pageSize : string ; pageOrientation : string } ;
13+ type PrintStyleProps = { pageSize : string } ;
1414const PrintStyle = createGlobalStyle < PrintStyleProps > `
1515 @media print {
1616 body, html {
1717 margin: 0;
1818 }
1919 @page {
20- size: ${ ( { pageSize, pageOrientation } ) =>
21- `${ pageSize } ${ pageOrientation } ` . trim ( ) } ;
20+ size: ${ ( { pageSize } ) => pageSize } ;
2221 }
2322 ${ AnimatedDiv } {
2423 @page {
@@ -33,19 +32,15 @@ export default function PrintMode({
3332 theme,
3433 exportMode,
3534 pageSize,
36- pageOrientation = '' ,
3735 backgroundImage,
3836 template
3937} : PrintModeProps ) {
4038 const width = theme ?. size ?. width || defaultTheme . size . width ;
4139 const height = theme ?. size ?. height || defaultTheme . size . height ;
42- const computedPageSize = pageSize || `${ width / 100 } in ${ height / 100 } in ` ;
40+ const computedPageSize = pageSize || `${ width } px ${ height } px ` ;
4341 return (
4442 < >
45- < PrintStyle
46- pageSize = { computedPageSize }
47- pageOrientation = { pageOrientation }
48- />
43+ < PrintStyle pageSize = { computedPageSize } />
4944 < DeckInternal
5045 printMode
5146 exportMode = { exportMode }
You can’t perform that action at this time.
0 commit comments