more fixes
unblock unplayable files fix context menu errors of pdfViwer
This commit is contained in:
parent
03c9e53dd2
commit
ec9448bc18
2 changed files with 27 additions and 5 deletions
|
@ -10,13 +10,26 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
class PdfViewer extends React.PureComponent<Props> {
|
class PdfViewer extends React.PureComponent<Props> {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.viewer = React.createRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Enable context-menu
|
||||||
|
stopContextMenu = event => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { source } = this.props;
|
const { source } = this.props;
|
||||||
return (
|
return (
|
||||||
<webview
|
<div className="file-render__viewer" onContextMenu={this.stopContextMenu}>
|
||||||
className="file-render__viewer"
|
<webview
|
||||||
src={`chrome://pdf-viewer/index.html?src=file://${source.downloadPath}`}
|
ref={this.viewer}
|
||||||
/>
|
src={`chrome://pdf-viewer/index.html?src=file://${source.downloadPath}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,16 @@ type Props = {
|
||||||
|
|
||||||
class FilePage extends React.Component<Props> {
|
class FilePage extends React.Component<Props> {
|
||||||
static PLAYABLE_MEDIA_TYPES = ['audio', 'video'];
|
static PLAYABLE_MEDIA_TYPES = ['audio', 'video'];
|
||||||
static PREVIEW_MEDIA_TYPES = ['text', 'image', 'document', '3D-file'];
|
static PREVIEW_MEDIA_TYPES = [
|
||||||
|
'text',
|
||||||
|
'model',
|
||||||
|
'image',
|
||||||
|
'3D-file',
|
||||||
|
'document',
|
||||||
|
// Bypass unplayable files
|
||||||
|
// TODO: Find a better way to detect supported types
|
||||||
|
'application',
|
||||||
|
];
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
Loading…
Reference in a new issue