2018-08-06 10:29:12 +00:00
|
|
|
import React from 'react';
|
2018-10-16 10:19:51 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2018-12-06 02:04:32 +00:00
|
|
|
import MarkdownViewer from '@seafile/seafile-editor/dist/viewer/markdown-viewer';
|
2018-08-06 10:29:12 +00:00
|
|
|
|
2018-09-07 02:36:15 +00:00
|
|
|
const gettext = window.gettext;
|
|
|
|
|
2018-10-16 10:19:51 +00:00
|
|
|
const viewerPropTypes = {
|
|
|
|
isFileLoading: PropTypes.bool.isRequired,
|
|
|
|
lastModified: PropTypes.string,
|
|
|
|
latestContributor: PropTypes.string,
|
|
|
|
markdownContent: PropTypes.string,
|
2018-12-06 02:04:32 +00:00
|
|
|
activeTitleIndex: PropTypes.number
|
2018-10-16 10:19:51 +00:00
|
|
|
};
|
|
|
|
|
2018-12-06 02:04:32 +00:00
|
|
|
class MarkdownContentViewer extends React.Component {
|
2018-08-06 10:29:12 +00:00
|
|
|
|
|
|
|
render() {
|
2018-08-17 04:23:55 +00:00
|
|
|
if (this.props.isFileLoading) {
|
2018-08-10 09:05:29 +00:00
|
|
|
return (
|
|
|
|
<span className="loading-icon loading-tip"></span>
|
2018-10-16 10:19:51 +00:00
|
|
|
);
|
2018-08-10 09:05:29 +00:00
|
|
|
}
|
2018-08-06 10:29:12 +00:00
|
|
|
return (
|
2018-12-06 02:04:32 +00:00
|
|
|
<div className="markdown-content">
|
|
|
|
<MarkdownViewer markdownContent={this.props.markdownContent} showTOC={true} activeTitleIndex={this.props.activeTitleIndex}/>
|
2018-10-16 10:19:51 +00:00
|
|
|
<p id="wiki-page-last-modified">{gettext('Last modified by')} {this.props.latestContributor}, <span>{this.props.lastModified}</span></p>
|
2018-08-10 09:05:29 +00:00
|
|
|
</div>
|
2018-10-16 10:19:51 +00:00
|
|
|
);
|
2018-08-06 10:29:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-06 02:04:32 +00:00
|
|
|
MarkdownContentViewer.propTypes = viewerPropTypes;
|
2018-10-16 10:19:51 +00:00
|
|
|
|
2018-12-06 02:04:32 +00:00
|
|
|
export default MarkdownContentViewer;
|