722c0b978c
Should support markdown, PDF, and anything in the code viewer. Tested that it's working on web and app.
25 lines
636 B
JavaScript
25 lines
636 B
JavaScript
// @flow
|
|
import React from 'react';
|
|
import { stopContextMenu } from 'util/context-menu';
|
|
|
|
type Props = {
|
|
source: string,
|
|
};
|
|
|
|
class HtmlViewer extends React.PureComponent<Props> {
|
|
render() {
|
|
const { source } = this.props;
|
|
return (
|
|
<div className="file-render__viewer" onContextMenu={stopContextMenu}>
|
|
{/* @if TARGET='app' */}
|
|
<iframe sandbox="" title={__('File preview')} src={`file://${source}`} />
|
|
{/* @endif */}
|
|
{/* @if TARGET='web' */}
|
|
<iframe sandbox="" title={__('File preview')} src={source} />
|
|
{/* @endif */}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default HtmlViewer;
|