mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #18806 from overleaf/dp-revert-18445
Remove workaround for chrome pdf rendering bug that has since been fixed GitOrigin-RevId: 622f04d6dad848dc725e0f1776ea37436a60dc63
This commit is contained in:
parent
fb2e3b3a25
commit
eb9044bc9b
1 changed files with 0 additions and 30 deletions
|
@ -461,36 +461,6 @@ function PdfJsViewer({ url, pdfFile }: PdfJsViewerProps) {
|
|||
[initialised, setZoom]
|
||||
)
|
||||
|
||||
/**
|
||||
* Work around an issue in Chrome 125 that causes canvas elements to become blank
|
||||
* when a tab is inactive, by making the canvas redraw when the tab becomes active.
|
||||
* https://github.com/mozilla/pdf.js/issues/18100
|
||||
* https://issues.chromium.org/issues/339654395
|
||||
* This can be removed once Chrome 127 is widely available.
|
||||
*/
|
||||
useEffect(() => {
|
||||
const listener = () => {
|
||||
if (document.visibilityState !== 'hidden' && pdfJsWrapper) {
|
||||
window.setTimeout(() => {
|
||||
for (const canvas of pdfJsWrapper.container.querySelectorAll(
|
||||
'canvas'
|
||||
)) {
|
||||
canvas.style.display = 'none'
|
||||
window.setTimeout(() => {
|
||||
canvas.style.display = 'block'
|
||||
}, 1)
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('visibilitychange', listener)
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('visibilitychange', listener)
|
||||
}
|
||||
}, [pdfJsWrapper])
|
||||
|
||||
// Don't render the toolbar until we have the necessary information
|
||||
const toolbarInfoLoaded =
|
||||
rawScale !== null && page !== null && totalPages !== null
|
||||
|
|
Loading…
Reference in a new issue