1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-23 09:11:15 +00:00
seahub/frontend/src/components/markdown-viewer.js

35 lines
1.0 KiB
JavaScript
Raw Normal View History

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';
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,
activeTitleIndex: PropTypes.number
2018-10-16 10:19:51 +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 (
<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
}
}
MarkdownContentViewer.propTypes = viewerPropTypes;
2018-10-16 10:19:51 +00:00
export default MarkdownContentViewer;