Răsfoiți Sursa

rerun r-fit-text based on printed slide size, fixes overflow when printing to PDF #2865

Hakim El Hattab 4 ani în urmă
părinte
comite
f576b98fbd
4 a modificat fișierele cu 15 adăugiri și 2 ștergeri
  1. 0 0
      dist/reveal.esm.js
  2. 0 0
      dist/reveal.js
  3. 4 0
      js/controllers/print.js
  4. 11 2
      js/controllers/slidecontent.js

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/reveal.esm.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/reveal.js


+ 4 - 0
js/controllers/print.js

@@ -59,6 +59,10 @@ export default class Print {
 				let left = ( pageWidth - slideWidth ) / 2,
 				let left = ( pageWidth - slideWidth ) / 2,
 					top = ( pageHeight - slideHeight ) / 2;
 					top = ( pageHeight - slideHeight ) / 2;
 
 
+				// Re-run the slide layout so that r-fit-text is applied based on
+				// the printed slide size
+				this.Reveal.slideContent.layout( slide );
+
 				let contentHeight = slide.scrollHeight;
 				let contentHeight = slide.scrollHeight;
 				let numberOfPages = Math.max( Math.ceil( contentHeight / pageHeight ), 1 );
 				let numberOfPages = Math.max( Math.ceil( contentHeight / pageHeight ), 1 );
 
 

+ 11 - 2
js/controllers/slidecontent.js

@@ -167,11 +167,20 @@ export default class SlideContent {
 
 
 		}
 		}
 
 
+		this.layout( slide );
+
+	}
+
+	/**
+	 * Applies JS-dependent layout helpers for the given slide,
+	 * if there are any.
+	 */
+	layout( slide ) {
+
 		// Autosize text with the r-fit-text class based on the
 		// Autosize text with the r-fit-text class based on the
 		// size of its container. This needs to happen after the
 		// size of its container. This needs to happen after the
 		// slide is visible in order to measure the text.
 		// slide is visible in order to measure the text.
-		Array.from( slide.querySelectorAll( '.r-fit-text:not([data-fitted])' ) ).forEach( element => {
-			element.dataset.fitted = '';
+		Array.from( slide.querySelectorAll( '.r-fit-text' ) ).forEach( element => {
 			fitty( element, {
 			fitty( element, {
 				minSize: 24,
 				minSize: 24,
 				maxSize: this.Reveal.getConfig().height * 0.8,
 				maxSize: this.Reveal.getConfig().height * 0.8,

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff