2015-02-12 23:22:32 -05:00
|
|
|
import Ember from 'ember';
|
2014-06-07 14:07:25 -05:00
|
|
|
|
2015-12-14 12:56:22 -05:00
|
|
|
const {Component} = Ember;
|
2015-10-28 06:36:45 -05:00
|
|
|
|
|
|
|
export default Component.extend({
|
2014-06-07 14:07:25 -05:00
|
|
|
classNames: ['content-preview-content'],
|
|
|
|
|
2015-06-13 09:34:09 -05:00
|
|
|
content: null,
|
|
|
|
|
2015-10-28 06:36:45 -05:00
|
|
|
didReceiveAttrs(options) {
|
2015-11-15 06:06:49 -05:00
|
|
|
this._super(...arguments);
|
|
|
|
|
2015-06-13 09:34:09 -05:00
|
|
|
// adjust when didReceiveAttrs gets both newAttrs and oldAttrs
|
|
|
|
if (options.newAttrs.content && this.get('content') !== options.newAttrs.content.value) {
|
|
|
|
let el = this.$();
|
2015-05-05 14:38:57 -05:00
|
|
|
|
2015-06-13 09:34:09 -05:00
|
|
|
if (el) {
|
|
|
|
el.closest('.content-preview').scrollTop(0);
|
|
|
|
}
|
2015-05-05 14:38:57 -05:00
|
|
|
}
|
2014-06-07 14:07:25 -05:00
|
|
|
}
|
|
|
|
});
|