Skip to content

Commit

Permalink
Fix PDF preview displaying before being positioned properly
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhad6 committed Oct 30, 2023
1 parent 45ed2d3 commit 68e4ad4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- PDF preview displaying before being positioned properly.

## [0.3.0] (Oct 25 2023)

### Added
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/pdfPreviewPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import pdfjsWorkerUrl from "pdfjs-dist/build/pdf.worker.js?file";
pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorkerUrl;

const pdfPreviewStyle = {
display: "none",
position: "fixed",
zIndex: 100,
overflow: "hidden",
Expand Down Expand Up @@ -53,7 +54,9 @@ function PdfComponent({
parentElement,
renderedHeight,
);
positionStyle = { display: hide ? "none" : undefined, top, left };
if (!hide) {
positionStyle = { display: undefined, top, left };
}
}

return (
Expand Down

0 comments on commit 68e4ad4

Please sign in to comment.