mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-26 15:26:19 +00:00
optimize history module
This commit is contained in:
@@ -29,20 +29,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.content-viewer {
|
.content-viewer {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-viewer .sf-slate-viewer-scroll-container {
|
||||||
background-color: #fafaf9;
|
background-color: #fafaf9;
|
||||||
border-radius: 10px;
|
padding: 20px 40px;
|
||||||
overflow: auto;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-viewer-render-content {
|
.content-viewer .sf-slate-viewer-article-container .article {
|
||||||
background-color: #fff;
|
width: 100%;
|
||||||
word-break: break-word;
|
max-width: 100%;
|
||||||
margin: 20px 40px;
|
|
||||||
border: 1px solid #e6e6dd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.markdown-viewer-render-content .diff-view {
|
|
||||||
padding: 40px 60px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-header {
|
.panel-header {
|
||||||
@@ -124,10 +124,14 @@
|
|||||||
.history-content .main-panel {
|
.history-content .main-panel {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
.markdown-viewer-render-content {
|
.content-viewer .sf-slate-viewer-scroll-container {
|
||||||
margin: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
.markdown-viewer-render-content .diff-view {
|
.content-viewer .sf-slate-viewer-article-container {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.content-viewer .sf-slate-viewer-article-container .article {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,19 +31,6 @@ class FileHistory extends React.Component {
|
|||||||
|
|
||||||
onHistoryItemClick = (item, preItem)=> {
|
onHistoryItemClick = (item, preItem)=> {
|
||||||
this.setState({renderingContent: true});
|
this.setState({renderingContent: true});
|
||||||
if (preItem) {
|
|
||||||
axios.all([
|
|
||||||
seafileAPI.getFileRevision(historyRepoID, item.commit_id, item.path),
|
|
||||||
seafileAPI.getFileRevision(historyRepoID, preItem.commit_id, preItem.path)
|
|
||||||
]).then(axios.spread((res, res1) => {
|
|
||||||
axios.all([
|
|
||||||
seafileAPI.getFileContent(res.data),
|
|
||||||
seafileAPI.getFileContent(res1.data)
|
|
||||||
]).then(axios.spread((content1, content2) => {
|
|
||||||
this.setDiffContent(content1.data, content2.data);
|
|
||||||
}));
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
seafileAPI.getFileRevision(historyRepoID, item.commit_id, item.path).then((res) => {
|
seafileAPI.getFileRevision(historyRepoID, item.commit_id, item.path).then((res) => {
|
||||||
axios.all([
|
axios.all([
|
||||||
seafileAPI.getFileContent(res.data),
|
seafileAPI.getFileContent(res.data),
|
||||||
@@ -51,7 +38,6 @@ class FileHistory extends React.Component {
|
|||||||
this.setDiffContent(content1.data, '');
|
this.setDiffContent(content1.data, '');
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onBackClick = (event) => {
|
onBackClick = (event) => {
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Prism from 'prismjs';
|
import Prism from 'prismjs';
|
||||||
import { DiffViewer } from '@seafile/seafile-editor';
|
import { MarkdownViewer } from '@seafile/seafile-editor';
|
||||||
import Loading from '../../components/loading';
|
import Loading from '../../components/loading';
|
||||||
import { mediaUrl } from '../../utils/constants';
|
import { mediaUrl } from '../../utils/constants';
|
||||||
|
|
||||||
const contentClass = 'markdown-viewer-render-content';
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
renderingContent: PropTypes.bool.isRequired,
|
renderingContent: PropTypes.bool.isRequired,
|
||||||
content: PropTypes.string,
|
content: PropTypes.string,
|
||||||
@@ -24,19 +23,18 @@ class MainPanel extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { renderingContent, newMarkdownContent } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className="content-viewer flex-fill">
|
<div className="content-viewer flex-fill">
|
||||||
<div className={contentClass}>
|
{renderingContent && <Loading />}
|
||||||
{this.props.renderingContent ?
|
{!renderingContent && (
|
||||||
(<Loading />) :
|
<MarkdownViewer
|
||||||
(<div className="diff-view article">
|
isFetching={renderingContent}
|
||||||
<DiffViewer
|
value={newMarkdownContent}
|
||||||
scriptSource={mediaUrl + 'js/mathjax/tex-svg.js'}
|
isShowOutline={false}
|
||||||
newMarkdownContent={this.props.newMarkdownContent}
|
mathJaxSource={mediaUrl + 'js/mathjax/tex-svg.js'}
|
||||||
oldMarkdownContent={this.props.oldMarkdownContent}
|
|
||||||
/>
|
/>
|
||||||
</div>)}
|
)}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user