2018-07-04 20:49:12 -06:00
|
|
|
// @flow
|
2018-10-15 00:26:46 -06:00
|
|
|
import * as React from 'react';
|
2018-11-21 16:20:55 -05:00
|
|
|
import { stopContextMenu } from 'util/context-menu';
|
2020-04-01 14:43:50 -04:00
|
|
|
import IframeReact from 'component/IframeReact';
|
2018-07-04 20:49:12 -06:00
|
|
|
|
|
|
|
type Props = {
|
2018-08-01 18:53:38 -06:00
|
|
|
source: string,
|
2018-07-04 20:49:12 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
class PdfViewer extends React.PureComponent<Props> {
|
2019-03-20 00:41:51 -04:00
|
|
|
render() {
|
2019-11-26 14:08:34 -05:00
|
|
|
const { source } = this.props;
|
2020-04-01 14:43:50 -04:00
|
|
|
const src = IS_WEB ? source : `file://${source}`;
|
2018-07-04 20:49:12 -06:00
|
|
|
return (
|
2020-04-13 19:48:11 -04:00
|
|
|
<div className="file-viewer file-viewer--document" onContextMenu={stopContextMenu}>
|
|
|
|
<div className="file-viewer file-viewer--iframe">
|
2020-04-01 14:43:50 -04:00
|
|
|
<IframeReact title={__('File preview')} src={src} />
|
2019-11-26 14:08:34 -05:00
|
|
|
</div>
|
2018-07-04 23:24:04 -06:00
|
|
|
</div>
|
2018-07-04 20:49:12 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PdfViewer;
|