mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 09:21:54 +00:00
fix-outline-scroll
This commit is contained in:
@@ -9,6 +9,7 @@ const viewerPropTypes = {
|
|||||||
lastModified: PropTypes.string,
|
lastModified: PropTypes.string,
|
||||||
latestContributor: PropTypes.string,
|
latestContributor: PropTypes.string,
|
||||||
markdownContent: PropTypes.string,
|
markdownContent: PropTypes.string,
|
||||||
|
onContentRendered: PropTypes.func,
|
||||||
activeTitleIndex: PropTypes.number
|
activeTitleIndex: PropTypes.number
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -22,7 +23,10 @@ class MarkdownContentViewer extends React.Component {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="markdown-content">
|
<div className="markdown-content">
|
||||||
<MarkdownViewer markdownContent={this.props.markdownContent} showTOC={true} activeTitleIndex={this.props.activeTitleIndex}/>
|
<MarkdownViewer markdownContent={this.props.markdownContent} showTOC={true}
|
||||||
|
activeTitleIndex={this.props.activeTitleIndex}
|
||||||
|
onContentRendered={this.props.onContentRendered}
|
||||||
|
/>
|
||||||
<p id="wiki-page-last-modified">{gettext('Last modified by')} {this.props.latestContributor}, <span>{this.props.lastModified}</span></p>
|
<p id="wiki-page-last-modified">{gettext('Last modified by')} {this.props.latestContributor}, <span>{this.props.lastModified}</span></p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -102,6 +102,10 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cur-view-content .article {
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
.cur-view-content .hd {
|
.cur-view-content .hd {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
margin-bottom: .5em;
|
margin-bottom: .5em;
|
||||||
|
@@ -169,7 +169,7 @@ img[src=""] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#wiki-page-last-modified {
|
#wiki-page-last-modified {
|
||||||
margin-top:40px;
|
padding:40px;
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
@@ -79,10 +79,6 @@ class MainPanel extends Component {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
let that = this;
|
|
||||||
setTimeout(function() {
|
|
||||||
that.getTitlesInfo();
|
|
||||||
}, 500);
|
|
||||||
if (this.props.hash) {
|
if (this.props.hash) {
|
||||||
let hash = this.props.hash;
|
let hash = this.props.hash;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@@ -134,8 +130,8 @@ class MainPanel extends Component {
|
|||||||
// todo
|
// todo
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePageScroll = (e) => {
|
handlePageScroll = () => {
|
||||||
if (this.props.pathExist && this.props.isViewFile && !this.pageScroll && this.titlesInfo.length > 0) {
|
if (this.props.pathExist && this.props.isViewFile && !this.pageScroll && this.titlesInfo && this.titlesInfo.length > 0) {
|
||||||
this.pageScroll = true;
|
this.pageScroll = true;
|
||||||
let that = this;
|
let that = this;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@@ -164,13 +160,8 @@ class MainPanel extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTitlesInfo = () => {
|
onContentRendered = (markdownViewer) => {
|
||||||
let titlesInfo = [];
|
this.titlesInfo = markdownViewer.titlesInfo;
|
||||||
let headingList = document.querySelectorAll('h2[id^="user-content"], h3[id^="user-content"]');
|
|
||||||
for (let i = 0; i < headingList.length; i++) {
|
|
||||||
titlesInfo.push(headingList[i].offsetTop);
|
|
||||||
}
|
|
||||||
this.titlesInfo = titlesInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -229,6 +220,7 @@ class MainPanel extends Component {
|
|||||||
lastModified = {this.props.lastModified}
|
lastModified = {this.props.lastModified}
|
||||||
isFileLoading={this.props.isFileLoading}
|
isFileLoading={this.props.isFileLoading}
|
||||||
activeTitleIndex={this.state.activeTitleIndex}
|
activeTitleIndex={this.state.activeTitleIndex}
|
||||||
|
onContentRendered={this.onContentRendered}
|
||||||
/> :
|
/> :
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<DirentListView
|
<DirentListView
|
||||||
|
Reference in New Issue
Block a user