fix(blob): Fix Print as PDF blank page and dark mode issues
What does this MR do and why?
This is a follow up to the Print as PDF for markdown files feature (#414692 (closed), merged in !238594 (merged)). After that MR merged, two problems were found (#602773 (closed)):
- Blank page on the first print attempt when the file is opened with a soft navigation (no full page reload). The print styles relied on the server rendered blob page structure, which is not present after a Vue Router navigation, so the content was hidden. The fix hides the page chrome directly instead of depending on that structure.
- Gray text in the print output for users with dark mode enabled. The dark mode stylesheet is loaded unconditionally for those users, so its dark text colors were used in print. The fix forces light text colors in print.
It also hides the file browser, repository header and file holder border so the print output only contains the rendered markdown.
Closes #602773 (closed)
References
- Initial proposal: #414692 (closed)
- Initial MR: !238594 (merged)
- Issue found after the initial MR merged: #602773 (closed)
How to set up and validate locally
- Open a markdown file in a repository, for example
CONTRIBUTING.md. - Open the download dropdown and click Print as PDF.
- Confirm the print preview shows the rendered markdown on the first attempt, with no file browser, header or surrounding box.
- Turn on dark mode in your user preferences and repeat. Confirm the text prints black, not gray.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.