mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Fix teardown of resize handler in content management screen
refs #5659 ([comment](https://github.com/TryGhost/Ghost/issues/5659#issuecomment-137114898)) - cleans up resize handler on willDestroy hook of gh-content-view-container
This commit is contained in:
parent
16d7790a19
commit
fe16ec24f0
@ -8,6 +8,8 @@ export default Ember.Component.extend({
|
||||
|
||||
resizeService: Ember.inject.service(),
|
||||
|
||||
_resizeListener: null,
|
||||
|
||||
calculatePreviewIsHidden: function () {
|
||||
if (this.$('.content-preview').length) {
|
||||
this.set('previewIsHidden', !this.$('.content-preview').is(':visible'));
|
||||
@ -16,8 +18,12 @@ export default Ember.Component.extend({
|
||||
|
||||
didInsertElement: function () {
|
||||
this._super(...arguments);
|
||||
this._resizeListener = Ember.run.bind(this, this.calculatePreviewIsHidden);
|
||||
this.get('resizeService').on('debouncedDidResize', this._resizeListener);
|
||||
this.calculatePreviewIsHidden();
|
||||
this.get('resizeService').on('debouncedDidResize',
|
||||
Ember.run.bind(this, this.calculatePreviewIsHidden));
|
||||
},
|
||||
|
||||
willDestroy: function () {
|
||||
this.get('resizeService').off('debouncedDidResize', this._resizeListener);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user