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

Fix text cutting off when printing and differences between clicking print and doing ctrl + P #10670

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GVodyanov
Copy link
Contributor

@GVodyanov GVodyanov commented Feb 9, 2025

Fix #9853

Previously for printing all we did was hide unnecessary DOM elements with CSS

What this PR actually does:

  • distinguish between printing singular messages (through the actions menu) and printing the whole thread with Ctrl + P
  • If printing a specific message only the iframe is printed, with thread info injected up top
  • If printing a whole thread with Ctrl + P some DOM elements are hidden with CSS, and some are removed forcefully with javascript. This is needed because browser printing APIs aren't the best, and even hidden elements mess up the layout with Chrome. The downside of this is that the browser cannot read elements inside of iframes, so text and images are split between multiple pages. After this is done the page has to be reloaded to restore the deleted elements.
  • Fix bug related to the print content being narrow in Firefox, this was caused by the actions menu still existing in the DOM even if hidden for a few seconds after being closed
  • Update iframe-resizer to version 5: now it split between two libraries, child and parent
  • Handle printing of plain text messages by creating an iframe and inserting them into it

@GVodyanov GVodyanov self-assigned this Feb 9, 2025
@GVodyanov
Copy link
Contributor Author

Note: narrow messages in firefox seem to reproducible only after having clicked the menu buttons in the thread element, even though the menu was subsequently closed..?

@GVodyanov GVodyanov force-pushed the fix/text-cutting-off-print branch from 0d018da to 4981e8f Compare March 6, 2025 19:31
@GVodyanov GVodyanov marked this pull request as ready for review March 6, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Printing edge case emails still does not always work
1 participant