0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

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 a5de701058
commit 4e9b815ba2

View file

@ -36,14 +36,15 @@ 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.$('.js-upload-target').attr('src', '');
this.$()[0].uploaderUi.reset();
this.$()[0].uploaderUi.initWithImage();
}
}
},
didInsertElement() {