1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 09:26:34 +02:00

Get rid of separate system for scrollToLast

This commit is contained in:
Alexander Skvortsov
2020-07-07 17:45:33 -04:00
committed by Franz Liedke
parent c98c0b027f
commit cc10eaadd2

View File

@@ -102,7 +102,7 @@ export default class PostStream extends Component {
}
config(isInitialized, context) {
console.log('redrawing');
console.log('redrawing', this.state.visibleStart, this.state.visibleEnd);
if (this.state.needsScroll) {
this.state.needsScroll = false;
const locationType = this.state.locationType;
@@ -279,20 +279,6 @@ export default class PostStream extends Component {
return this.$() && $('#header').outerHeight() + parseInt(this.$().css('margin-top'), 10);
}
scrollToLast() {
return $('html,body')
.stop(true)
.animate(
{
scrollTop: $(document).height() - $(window).height(),
},
'fast',
() => {
this.flashItem(this.$('.PostStream-item:last-child'));
}
);
}
/**
* Scroll down to a certain post by number and 'flash' it.
*
@@ -322,7 +308,7 @@ export default class PostStream extends Component {
return this.scrollToItem($item, noAnimation, true, bottom).done(() => {
if (index == this.state.count() - 1) {
return this.scrollToLast();
this.flashItem(this.$('.PostStream-item:last-child'));
}
});
}