datasync-blob 1.1.31 → 1.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DsBlob.js +26 -6
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ class DsBlob extends _react.Component {
|
|
|
17
17
|
data: props.data || "",
|
|
18
18
|
binaryData: props.binaryData || null
|
|
19
19
|
};
|
|
20
|
-
this.debugging =
|
|
20
|
+
this.debugging = false;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
//-----------------------------------------
|
|
@@ -149,7 +149,7 @@ class DsBlob extends _react.Component {
|
|
|
149
149
|
context,
|
|
150
150
|
width = imageSource.width,
|
|
151
151
|
height = imageSource.height;
|
|
152
|
-
if (
|
|
152
|
+
if (this.debugging) {
|
|
153
153
|
alert(`Debugging : pixel is ${width} x ${height}`);
|
|
154
154
|
console.log("imageSource = ", imageSource);
|
|
155
155
|
}
|
|
@@ -267,6 +267,9 @@ class DsBlob extends _react.Component {
|
|
|
267
267
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
268
268
|
storeBase64ImageToImg = e => {
|
|
269
269
|
var DOM_image = document.createElement('img');
|
|
270
|
+
alert("BIRTHDAY !");
|
|
271
|
+
console.log("BIRTHDAY:Store DOMimage reference");
|
|
272
|
+
this._DOM_image = DOM_image;
|
|
270
273
|
DOM_image.onload = this.reduceBase64Image;
|
|
271
274
|
console.log("storeBase64ImageToImg:e.currentTarget.result = ", e.currentTarget.result);
|
|
272
275
|
DOM_image.src = e.currentTarget.result;
|
|
@@ -296,9 +299,8 @@ class DsBlob extends _react.Component {
|
|
|
296
299
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
297
300
|
cleanupBlobUrl = () => {
|
|
298
301
|
// Only show alert if not in test environment
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
+
console.log("cleanupBlobUrl !");
|
|
303
|
+
|
|
302
304
|
// Revoke blob URL if it exists to prevent memory leaks
|
|
303
305
|
if (this.state.data && this.state.data.startsWith('blob:')) {
|
|
304
306
|
URL.revokeObjectURL(this.state.data);
|
|
@@ -325,6 +327,11 @@ class DsBlob extends _react.Component {
|
|
|
325
327
|
componentWillUnmount() {
|
|
326
328
|
// Cleanup blob URLs when component unmounts
|
|
327
329
|
this.cleanupBlobUrl();
|
|
330
|
+
if (this._DOM_image) {
|
|
331
|
+
console.log("BIRTHDAY : Removing reference");
|
|
332
|
+
this._DOM_image.onload = null;
|
|
333
|
+
this._DOM_image = null;
|
|
334
|
+
}
|
|
328
335
|
}
|
|
329
336
|
|
|
330
337
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
@@ -477,7 +484,20 @@ class DsBlob extends _react.Component {
|
|
|
477
484
|
type: "button",
|
|
478
485
|
value: "Effacer",
|
|
479
486
|
onClick: this.resetUpload
|
|
480
|
-
})
|
|
487
|
+
}), !this.props.readOnly && /*#__PURE__*/_react.default.createElement("label", {
|
|
488
|
+
style: this.state.hover_input ? {
|
|
489
|
+
...div_show_image_hover_input,
|
|
490
|
+
top: "32px",
|
|
491
|
+
cursor: "pointer"
|
|
492
|
+
} : div_show_image_input,
|
|
493
|
+
className: "btn btn-secondary"
|
|
494
|
+
}, this.props.Caption || 'Remplacer', /*#__PURE__*/_react.default.createElement("input", {
|
|
495
|
+
style: upload_picture_label_input,
|
|
496
|
+
type: "file",
|
|
497
|
+
accept: "image/*",
|
|
498
|
+
onChange: this.onInputChange,
|
|
499
|
+
multiple: true
|
|
500
|
+
}))));
|
|
481
501
|
}
|
|
482
502
|
}
|
|
483
503
|
exports.DsBlob = DsBlob;
|