2019-02-26 08:18:43 +00:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
2019-03-26 12:04:18 +00:00
|
|
|
import { siteRoot } from './utils/constants';
|
|
|
|
import FileView from './components/file-view/file-view';
|
2019-02-26 08:18:43 +00:00
|
|
|
import FileViewTip from './components/file-view/file-view-tip';
|
|
|
|
|
|
|
|
import './css/image-file-view.css';
|
|
|
|
|
2019-03-26 12:04:18 +00:00
|
|
|
const { err, fileName, xmindImageSrc } = window.app.pageOptions;
|
2019-02-26 08:18:43 +00:00
|
|
|
|
|
|
|
class ViewFileXmind extends React.Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2019-03-26 12:04:18 +00:00
|
|
|
<FileView content={<FileContent />} />
|
2019-02-26 08:18:43 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class FileContent extends React.Component {
|
|
|
|
render() {
|
|
|
|
if (err) {
|
|
|
|
return <FileViewTip />;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<div className="file-view-content flex-1 image-file-view">
|
|
|
|
<img src={`${siteRoot}${xmindImageSrc}`} alt={fileName} id="image-view" />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render (
|
|
|
|
<ViewFileXmind />,
|
|
|
|
document.getElementById('wrapper')
|
|
|
|
);
|