Fix image with same pathname not updated

&& add boolean in onechange
This commit is contained in:
Jérémie Boulay 2020-06-19 18:30:29 -04:00
parent d85554b032
commit 011949e757

View File

@ -29,6 +29,8 @@ class ImageController extends Controller {
constructor(object, property) { constructor(object, property) {
super(object, property); super(object, property);
this.__onChangeFirstTime = true;
this.__fileReader = new FileReader(); this.__fileReader = new FileReader();
const _this = this; const _this = this;
@ -62,7 +64,8 @@ class ImageController extends Controller {
_this.__imagePreview.src = _this.__image.src; _this.__imagePreview.src = _this.__image.src;
if (_this.__onChange) { if (_this.__onChange) {
_this.__onChange.call(_this, _this.__image); _this.__onChange.call(_this, _this.__image, _this.__onChangeFirstTime);
_this.__onChangeFirstTime = false;
} }
} }
@ -71,6 +74,7 @@ class ImageController extends Controller {
if (!file) { if (!file) {
return; return;
} }
_this.__input.value = '';
_this.__fileReader.readAsDataURL(file); _this.__fileReader.readAsDataURL(file);
} }