Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing With r-fit-text Too Big #2865

Closed
eljefe6a opened this issue Dec 16, 2020 · 3 comments
Closed

Printing With r-fit-text Too Big #2865

eljefe6a opened this issue Dec 16, 2020 · 3 comments

Comments

@eljefe6a
Copy link

eljefe6a commented Dec 16, 2020

I've isolated a bug when printing an element that uses r-fit-text. When you go to print, the element's text is far too big and exceeds the limit of the element.

To work around the issue, you have to wait to initialize Revealjs or manually resize the window.

This code replicates the issue on 4.1.0:

<!doctype html>
<html>
	<head>
		<title>reveal.js</title>

		<link rel="stylesheet" href="dist/reset.css">
		<link rel="stylesheet" href="dist/reveal.css">
		<link rel="stylesheet" href="dist/theme/white.css" id="theme">
	</head>
	<body>
		<div class="reveal">
			<div class="slides">
				<section><p>Add the <code>r-fit-text</code> class to auto-size text</p><h2 class="r-fit-text">FIT TEXT</h2></section>
			</div>
		</div>

		<script src="dist/reveal.js"></script>
		<script src="plugin/notes/notes.js"></script>
		<script src="plugin/markdown/markdown.js"></script>
		<script src="plugin/highlight/highlight.js"></script>
		<script>
			// More info about initialization & config:
			// - https://revealjs.com/initialization/
			// - https://revealjs.com/config/
			Reveal.initialize({
				hash: true,

				// Learn about plugins: https://revealjs.com/plugins/
				plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
			});
		</script>
	</body>
</html>

This code works around the issue on 4.1.0:

<!doctype html>
<html>
	<head>
		<title>reveal.js</title>

		<link rel="stylesheet" href="dist/reset.css">
		<link rel="stylesheet" href="dist/reveal.css">
		<link rel="stylesheet" href="dist/theme/white.css" id="theme">
	</head>
	<body>
		<div class="reveal">
			<div class="slides">
				<section><p>Add the <code>r-fit-text</code> class to auto-size text</p><h2 class="r-fit-text">FIT TEXT</h2></section>
			</div>
		</div>

		<script src="dist/reveal.js"></script>
		<script src="plugin/notes/notes.js"></script>
		<script src="plugin/markdown/markdown.js"></script>
		<script src="plugin/highlight/highlight.js"></script>
		<script>
			window.setTimeout(function(){
			// More info about initialization & config:
			// - https://revealjs.com/initialization/
			// - https://revealjs.com/config/
			Reveal.initialize({
				hash: true,

				// Learn about plugins: https://revealjs.com/plugins/
				plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
			})}, 1000);
		</script>
	</body>
</html>

The difference between the two is a setTimeout that delays the initialize().

@hakimel
Copy link
Owner

hakimel commented Dec 17, 2020

Thanks for reporting! This should be fixed now f576b98

@hakimel hakimel closed this as completed Dec 17, 2020
R0bes pushed a commit to R0bes/Terraform-Presentation that referenced this issue Jun 7, 2021
@trumbitta
Copy link

This is still an issue for me in 4.2.0 :-/

@hakimel
Copy link
Owner

hakimel commented Nov 16, 2021

I merged a performance optimization that broke this in acafabf#diff-4e186b3cdd8d0091137086ebf5fe3a9d360b602194bfec89f58d230d18511f42

I've change it back so that fit-text works correctly again. Available in master but not in a release yet.

stefanocampanella pushed a commit to stefanocampanella/reveal.js that referenced this issue Mar 1, 2022
srwohl pushed a commit to srwohl/phantom-pres that referenced this issue Sep 2, 2024
srwohl pushed a commit to srwohl/phantom-pres that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@trumbitta @hakimel @eljefe6a and others