Ensure image lightbox is aware of its underlying message changes
This commit is contained in:
parent
ae2db9f09a
commit
667b2e63f1
2 changed files with 15 additions and 6 deletions
|
@ -1275,8 +1275,12 @@
|
||||||
className: 'lightbox-wrapper',
|
className: 'lightbox-wrapper',
|
||||||
Component: Signal.Components.Lightbox,
|
Component: Signal.Components.Lightbox,
|
||||||
props,
|
props,
|
||||||
onClose: () => Signal.Backbone.Views.Lightbox.hide(),
|
onClose: () => {
|
||||||
|
Signal.Backbone.Views.Lightbox.hide();
|
||||||
|
this.stopListening(message);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
this.listenTo(message, 'expired', () => this.lightboxView.remove());
|
||||||
Signal.Backbone.Views.Lightbox.show(this.lightboxView.el);
|
Signal.Backbone.Views.Lightbox.show(this.lightboxView.el);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1304,8 +1308,14 @@
|
||||||
className: 'lightbox-wrapper',
|
className: 'lightbox-wrapper',
|
||||||
Component: Signal.Components.LightboxGallery,
|
Component: Signal.Components.LightboxGallery,
|
||||||
props,
|
props,
|
||||||
onClose: () => Signal.Backbone.Views.Lightbox.hide(),
|
onClose: () => {
|
||||||
|
Signal.Backbone.Views.Lightbox.hide();
|
||||||
|
this.stopListening(message);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
this.listenTo(message, 'expired', () =>
|
||||||
|
this.lightboxGalleryView.remove()
|
||||||
|
);
|
||||||
Signal.Backbone.Views.Lightbox.show(this.lightboxGalleryView.el);
|
Signal.Backbone.Views.Lightbox.show(this.lightboxGalleryView.el);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -53,16 +53,15 @@
|
||||||
augmentProps(props) {
|
augmentProps(props) {
|
||||||
return Object.assign({}, props, {
|
return Object.assign({}, props, {
|
||||||
close: () => {
|
close: () => {
|
||||||
if (this.onClose) {
|
|
||||||
this.onClose();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.remove();
|
this.remove();
|
||||||
},
|
},
|
||||||
i18n,
|
i18n,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
|
if (this.onClose) {
|
||||||
|
this.onClose();
|
||||||
|
}
|
||||||
ReactDOM.unmountComponentAtNode(this.el);
|
ReactDOM.unmountComponentAtNode(this.el);
|
||||||
Backbone.View.prototype.remove.call(this);
|
Backbone.View.prototype.remove.call(this);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue