2019-02-01 10:44:10 +00:00
|
|
|
import React from 'react';
|
2022-12-29 04:21:47 +00:00
|
|
|
import ReactDom from 'react-dom';
|
2019-03-28 02:59:43 +00:00
|
|
|
import SharedFileView from './components/shared-file-view/shared-file-view';
|
|
|
|
import SharedFileViewTip from './components/shared-file-view/shared-file-view-tip';
|
2022-12-29 04:21:47 +00:00
|
|
|
import SeafileCodeMirror from './components/seafile-codemirror';
|
2019-03-28 02:59:43 +00:00
|
|
|
import './css/text-file-view.css';
|
2019-02-01 10:44:10 +00:00
|
|
|
|
2019-03-28 02:59:43 +00:00
|
|
|
const { err, fileExt, fileContent } = window.shared.pageOptions;
|
2019-02-01 10:44:10 +00:00
|
|
|
|
2019-03-28 02:59:43 +00:00
|
|
|
class FileContent extends React.Component {
|
2019-02-01 10:44:10 +00:00
|
|
|
render() {
|
2019-03-28 02:59:43 +00:00
|
|
|
if (err) {
|
|
|
|
return <SharedFileViewTip />;
|
|
|
|
}
|
|
|
|
|
2019-02-01 10:44:10 +00:00
|
|
|
return (
|
2019-03-28 02:59:43 +00:00
|
|
|
<div className="shared-file-view-body text-file-view">
|
2022-12-29 04:21:47 +00:00
|
|
|
<SeafileCodeMirror fileExt={fileExt} value={fileContent} />
|
2019-02-01 10:44:10 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-29 04:21:47 +00:00
|
|
|
class SharedFileViewText extends React.Component {
|
|
|
|
render() {
|
|
|
|
return <SharedFileView content={<FileContent />} />;
|
|
|
|
}
|
|
|
|
}
|
2022-12-24 02:41:34 +00:00
|
|
|
|
2022-12-29 04:21:47 +00:00
|
|
|
ReactDom.render(<SharedFileViewText />, document.getElementById('wrapper'));
|