Clear images in gh-uploader when navigating between items

closes #6198
- clear img src in gh-uploader when navigating to item with image
- always reset uploader component when new image is not empty
This commit is contained in:
Kevin P. Kucharczyk 2016-01-16 21:54:02 +01:00
parent 9fda1dc5ba
commit 41a18c9262

View File

@ -36,13 +36,14 @@ export default Component.extend({
this.$()[0].uploaderUi.reset();
}
// re-init if we receive a new image but the uploader is blank
// re-init if we receive a new image
// - handles back button navigating from blank image to populated image
// - handles navigating between populated images
if (!isEmpty(newValue) && this.$()) {
if (this.$('.js-upload-target').attr('src') === '') {
this.$()[0].uploaderUi.reset();
this.$()[0].uploaderUi.initWithImage();
}
this.$('.js-upload-target').attr('src', '');
this.$()[0].uploaderUi.reset();
this.$()[0].uploaderUi.initWithImage();
}
},