react-mention-input 1.1.27 → 1.1.28

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.
@@ -326,7 +326,12 @@ var MentionInput = function (_a) {
326
326
  case 1:
327
327
  _a.sent();
328
328
  _a.label = 2;
329
- case 2: return [2 /*return*/];
329
+ case 2:
330
+ // Reset the input value to allow selecting the same file again
331
+ if (fileInputRef.current) {
332
+ fileInputRef.current.value = '';
333
+ }
334
+ return [2 /*return*/];
330
335
  }
331
336
  });
332
337
  }); };
@@ -407,6 +412,10 @@ var MentionInput = function (_a) {
407
412
  var removeImage = function () {
408
413
  setSelectedImage(null);
409
414
  setImageUrl(null);
415
+ // Reset the input value when image is removed
416
+ if (fileInputRef.current) {
417
+ fileInputRef.current.value = '';
418
+ }
410
419
  };
411
420
  var handleSendMessage = function () {
412
421
  if (inputRef.current) {
@@ -428,6 +437,10 @@ var MentionInput = function (_a) {
428
437
  setImageUrl(null);
429
438
  userSelectListRef.current = [];
430
439
  userSelectListWithIdsRef.current = [];
440
+ // Reset the file input value after sending
441
+ if (fileInputRef.current) {
442
+ fileInputRef.current.value = '';
443
+ }
431
444
  }
432
445
  }
433
446
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-mention-input",
3
- "version": "1.1.27",
3
+ "version": "1.1.28",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -427,6 +427,10 @@ const MentionInput: React.FC<MentionInputProps> = ({
427
427
  await uploadImage(file);
428
428
  }
429
429
  }
430
+ // Reset the input value to allow selecting the same file again
431
+ if (fileInputRef.current) {
432
+ fileInputRef.current.value = '';
433
+ }
430
434
  };
431
435
 
432
436
  const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {
@@ -493,6 +497,10 @@ const MentionInput: React.FC<MentionInputProps> = ({
493
497
  const removeImage = () => {
494
498
  setSelectedImage(null);
495
499
  setImageUrl(null);
500
+ // Reset the input value when image is removed
501
+ if (fileInputRef.current) {
502
+ fileInputRef.current.value = '';
503
+ }
496
504
  };
497
505
 
498
506
  const handleSendMessage = () => {
@@ -516,6 +524,10 @@ const MentionInput: React.FC<MentionInputProps> = ({
516
524
  setImageUrl(null);
517
525
  userSelectListRef.current = [];
518
526
  userSelectListWithIdsRef.current = [];
527
+ // Reset the file input value after sending
528
+ if (fileInputRef.current) {
529
+ fileInputRef.current.value = '';
530
+ }
519
531
  }
520
532
  }
521
533
  };