mirror of
https://github.com/flarum/core.git
synced 2025-08-07 17:07:19 +02:00
When scrolling to first post, scroll all the way to top, simplify scrollToItem promise structure
This commit is contained in:
committed by
Franz Liedke
parent
228c7b883d
commit
88e6be9d0e
@@ -342,15 +342,15 @@ export default class PostStream extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.all([$container.promise(), this.state.loadPromise])
|
||||
.then(() => {
|
||||
m.redraw(true);
|
||||
return $(window).scrollTop($(`.PostStream-item[data-index=${$item.data('index')}]`).offset().top - this.getMarginTop());
|
||||
})
|
||||
.then(() => {
|
||||
return this.calculatePosition();
|
||||
})
|
||||
.then(() => this.state.unpause());
|
||||
return Promise.all([$container.promise(), this.state.loadPromise]).then(() => {
|
||||
const index = $item.data('index');
|
||||
this.updateScrubber();
|
||||
m.redraw(true);
|
||||
const scroll = index == 0 ? 0 : $(`.PostStream-item[data-index=${$item.data('index')}]`).offset().top - this.getMarginTop();
|
||||
$(window).scrollTop(scroll);
|
||||
this.calculatePosition();
|
||||
this.state.unpause();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user