-
-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate react-pdf-viewer for PDF display (#1112)
- Loading branch information
Showing
32 changed files
with
33,602 additions
and
10,938 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 12 additions & 9 deletions
21
frontend/src/static/js/components/media-viewer/PdfViewer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import React from 'react'; | ||
import { Worker, Viewer } from '@react-pdf-viewer/core'; | ||
import { defaultLayoutPlugin } from '@react-pdf-viewer/default-layout'; | ||
|
||
export default function PdfViewer() { | ||
import '@react-pdf-viewer/core/lib/styles/index.css' | ||
import '@react-pdf-viewer/default-layout/lib/styles/index.css'; | ||
|
||
|
||
export default function PdfViewer({ fileUrl }) { | ||
const defaultLayoutPluginInstance = defaultLayoutPlugin(); | ||
return ( | ||
<div className="player-container viewer-pdf-container"> | ||
<div className="player-container-inner"> | ||
<span> | ||
<span> | ||
<i className="material-icons">insert_drive_file</i> | ||
</span> | ||
</span> | ||
<div className='pdf-container'> | ||
<Worker workerUrl="https://unpkg.com/[email protected]/build/pdf.worker.min.js"> | ||
<Viewer fileUrl={fileUrl} plugins={[defaultLayoutPluginInstance]} /> | ||
</Worker> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,45 @@ object-assign | |
* @license MIT | ||
*/ | ||
|
||
/*! | ||
* The buffer module from node.js, for the browser. | ||
* | ||
* @author Feross Aboukhadijeh <https://feross.org> | ||
* @license MIT | ||
*/ | ||
|
||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
|
||
/** | ||
* @licstart The following is the entire license notice for the | ||
* JavaScript code in this page | ||
* | ||
* Copyright 2023 Mozilla Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @licend The above is the entire license notice for the | ||
* JavaScript code in this page | ||
*/ | ||
|
||
/** | ||
* A React component to view a PDF document | ||
* | ||
* @see https://react-pdf-viewer.dev | ||
* @license https://react-pdf-viewer.dev/license | ||
* @copyright 2019-2023 Nguyen Huu Phuoc <[email protected]> | ||
*/ | ||
|
||
/** @license React v0.20.2 | ||
* scheduler.production.min.js | ||
* | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
cf93a77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you !