mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
3635fa1c1d
When scrolling through the preview of a long article, if the post was changed the scroll position of the preview would remain the same.
25 lines
647 B
JavaScript
25 lines
647 B
JavaScript
import setScrollClassName from 'ghost/utils/set-scroll-classname';
|
|
|
|
var PostContentView = Ember.View.extend({
|
|
classNames: ['content-preview-content'],
|
|
|
|
didInsertElement: function () {
|
|
var el = this.$();
|
|
el.on('scroll', Ember.run.bind(el, setScrollClassName, {
|
|
target: el.closest('.content-preview'),
|
|
offset: 10
|
|
}));
|
|
},
|
|
|
|
contentObserver: function () {
|
|
this.$().closest('.content-preview').scrollTop(0);
|
|
}.observes('controller.content'),
|
|
|
|
willDestroyElement: function () {
|
|
var el = this.$();
|
|
el.off('scroll');
|
|
}
|
|
});
|
|
|
|
export default PostContentView;
|