1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-18 17:22:05 +00:00
seahub/frontend/src/shared-file-view-text.js

31 lines
878 B
JavaScript
Raw Normal View History

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