2018-09-12 17:01:48 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Prism from 'prismjs';
|
|
|
|
import Loading from '../../components/loading';
|
2018-10-15 15:51:29 +08:00
|
|
|
import DiffViewer from '@seafile/seafile-editor/dist/viewer/diff-viewer';
|
2018-09-26 02:27:14 -07:00
|
|
|
|
2018-10-15 15:51:29 +08:00
|
|
|
require('@seafile/seafile-editor/dist/editor/code-hight-package');
|
2018-09-12 17:01:48 +08:00
|
|
|
|
|
|
|
const contentClass = 'markdown-viewer-render-content';
|
|
|
|
const propTypes = {
|
|
|
|
renderingContent: PropTypes.bool.isRequired,
|
2018-10-09 10:56:59 +08:00
|
|
|
content: PropTypes.string,
|
2018-12-25 10:39:57 +08:00
|
|
|
newMarkdownContent: PropTypes.string.isRequired,
|
|
|
|
oldMarkdownContent: PropTypes.string.isRequired,
|
2018-09-12 17:01:48 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class MainPanel extends React.Component {
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
Prism.highlightAll();
|
|
|
|
}
|
|
|
|
|
2018-09-25 09:13:06 +08:00
|
|
|
onSearchedClick = () => {
|
2018-09-19 21:19:11 -05:00
|
|
|
//todos;
|
|
|
|
}
|
|
|
|
|
2018-09-12 17:01:48 +08:00
|
|
|
render() {
|
|
|
|
return (
|
2018-12-25 10:39:57 +08:00
|
|
|
<div className="main-panel">
|
|
|
|
<div className="main-panel-center content-viewer">
|
|
|
|
{
|
|
|
|
this.props.renderingContent ?
|
|
|
|
(<div className={contentClass + ' article'}><Loading /></div>) :
|
|
|
|
(<div className={contentClass + ' article'}>
|
|
|
|
<DiffViewer
|
|
|
|
newMarkdownContent={this.props.newMarkdownContent}
|
|
|
|
oldMarkdownContent={this.props.oldMarkdownContent}
|
|
|
|
/>
|
|
|
|
</div>)
|
|
|
|
}
|
2018-09-12 17:01:48 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MainPanel.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default MainPanel;
|