should fix scrolling on forceupdate
Этот коммит содержится в:
@@ -85,7 +85,7 @@ module.exports = React.createClass({
|
|||||||
<div className="post__content">
|
<div className="post__content">
|
||||||
<PostHeader post={post} sameRoot={this.props.sameRoot} commentCount={commentCount} handleCommentClick={this.handleCommentClick} isLastComment={this.props.isLastComment} />
|
<PostHeader post={post} sameRoot={this.props.sameRoot} commentCount={commentCount} handleCommentClick={this.handleCommentClick} isLastComment={this.props.isLastComment} />
|
||||||
<PostBody post={post} sameRoot={this.props.sameRoot} parentPost={parentPost} posts={posts} handleCommentClick={this.handleCommentClick} />
|
<PostBody post={post} sameRoot={this.props.sameRoot} parentPost={parentPost} posts={posts} handleCommentClick={this.handleCommentClick} />
|
||||||
<PostInfo post={post} sameRoot={this.props.sameRoot} commentCount={commentCount} handleCommentClick={this.handleCommentClick} allowReply="true" />
|
<PostInfo ref="info" post={post} sameRoot={this.props.sameRoot} commentCount={commentCount} handleCommentClick={this.handleCommentClick} allowReply="true" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ module.exports = React.createClass({
|
|||||||
oldScrollHeight: 0,
|
oldScrollHeight: 0,
|
||||||
oldZoom: 0,
|
oldZoom: 0,
|
||||||
scrolledToNew: false,
|
scrolledToNew: false,
|
||||||
|
p: 0,
|
||||||
|
wasForced: false,
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
var user = UserStore.getCurrentUser();
|
var user = UserStore.getCurrentUser();
|
||||||
if (user.props && user.props.theme) {
|
if (user.props && user.props.theme) {
|
||||||
@@ -108,6 +110,12 @@ module.exports = React.createClass({
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(post_holder).scroll(function(e){
|
$(post_holder).scroll(function(e){
|
||||||
|
if (self.wasForced) {
|
||||||
|
console.log('hit');
|
||||||
|
$(post_holder).scrollTop(self.p);
|
||||||
|
$(post_holder).perfectScrollbar('update');
|
||||||
|
self.wasForced = false;
|
||||||
|
}
|
||||||
if (!self.preventScrollTrigger) {
|
if (!self.preventScrollTrigger) {
|
||||||
self.scrollPosition = $(post_holder).scrollTop() + $(post_holder).innerHeight();
|
self.scrollPosition = $(post_holder).scrollTop() + $(post_holder).innerHeight();
|
||||||
}
|
}
|
||||||
@@ -197,7 +205,10 @@ module.exports = React.createClass({
|
|||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
} else {
|
} else {
|
||||||
// Updates the timestamp on each post
|
// Updates the timestamp on each post
|
||||||
|
this.wasForced = true;
|
||||||
|
this.p = $(".post-list-holder-by-time").scrollTop();
|
||||||
this.forceUpdate()
|
this.forceUpdate()
|
||||||
|
//this.refs.post0.refs.info.forceUpdate();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_onSocketChange: function(msg) {
|
_onSocketChange: function(msg) {
|
||||||
@@ -452,7 +463,7 @@ module.exports = React.createClass({
|
|||||||
isLastComment = (i === 0 || posts[order[i-1]].root_id != post.root_id);
|
isLastComment = (i === 0 || posts[order[i-1]].root_id != post.root_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
var postCtl = <Post sameUser={sameUser} sameRoot={sameRoot} post={post} parentPost={parentPost} key={post.id} posts={posts} hideProfilePic={hideProfilePic} isLastComment={isLastComment} />;
|
var postCtl = <Post ref={"post"+(order.length-i-1)}sameUser={sameUser} sameRoot={sameRoot} post={post} parentPost={parentPost} key={post.id} posts={posts} hideProfilePic={hideProfilePic} isLastComment={isLastComment} />;
|
||||||
|
|
||||||
currentPostDay = utils.getDateForUnixTicks(post.create_at);
|
currentPostDay = utils.getDateForUnixTicks(post.create_at);
|
||||||
if(currentPostDay.getDate() !== previousPostDay.getDate() || currentPostDay.getMonth() !== previousPostDay.getMonth() || currentPostDay.getFullYear() !== previousPostDay.getFullYear()) {
|
if(currentPostDay.getDate() !== previousPostDay.getDate() || currentPostDay.getMonth() !== previousPostDay.getMonth() || currentPostDay.getFullYear() !== previousPostDay.getFullYear()) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user