mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2024-04-21 12:32:08 +00:00
fix (pdf): pdf viewer in firefox
This commit is contained in:
@@ -14,6 +14,7 @@ export const PDFViewer = (props) => {
|
||||
const ViewerComponent = "application/pdf" in navigator.mimeTypes ?
|
||||
<embed src={props.data+"#toolbar=0"} type="application/pdf" style={{height: "100%", width: "100%"}}></embed>
|
||||
: <PDFJSViewer src={props.data} />;
|
||||
|
||||
return (
|
||||
<div className="component_pdfviewer">
|
||||
<MenuBar title={props.filename} download={props.data} />
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import React from "react";
|
||||
import "react-pdf/dist/Page/AnnotationLayer.css";
|
||||
import { Document, Page, pdfjs } from "react-pdf";
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = "/assets/vendor/pdfjs/build/pdf.worker.min.js";
|
||||
|
||||
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = "/assets/vendor/pdfjs/2.6.347/build/pdf.worker.js";
|
||||
|
||||
export class PDFJSViewer extends React.Component {
|
||||
state = {
|
||||
@@ -20,8 +21,7 @@ export class PDFJSViewer extends React.Component {
|
||||
options={{
|
||||
cMapUrl: "/assets/vendor/pdfjs/cmaps/",
|
||||
cMapPacked: true,
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
{
|
||||
Array.from(
|
||||
new Array(this.state.numPages),
|
||||
|
||||
+1
-2
@@ -18,7 +18,6 @@
|
||||
"codemirror": "^5.26.0",
|
||||
"exif-js": "^2.3.0",
|
||||
"little-loader": "^0.2.0",
|
||||
"pdfjs-dist": "^2.1.266",
|
||||
"prop-types": "^15.5.10",
|
||||
"react": "^16.5.0",
|
||||
"react-addons-css-transition-group": "^15.6.2",
|
||||
@@ -27,7 +26,7 @@
|
||||
"react-dom": "^16.5.0",
|
||||
"react-draggable": "^2.2.6",
|
||||
"react-infinite-scroller": "^1.1.4",
|
||||
"react-pdf": "^4.1.0",
|
||||
"react-pdf": "5.3.2", "pdfjs-dist": "2.6.347",
|
||||
"react-router": "^4.3.1",
|
||||
"react-router-dom": "^4.3.1",
|
||||
"react-selectable": "git+https://github.com/mickael-kerjean/react-selectable.git",
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ let config = {
|
||||
{ from: "assets/fonts/*" },
|
||||
], { context: path.join(__dirname, 'client') }),
|
||||
new CopyWebpackPlugin([
|
||||
{ from: "node_modules/pdfjs-dist/", to: "assets/vendor/pdfjs"}
|
||||
{ from: "node_modules/pdfjs-dist/", to: "assets/vendor/pdfjs/2.6.347/"}
|
||||
]),
|
||||
//new BundleAnalyzerPlugin()
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user