Explorar el Código

Fix #1735: Correct file caption reset after thumbnail delete

Kartik Visweswaran hace 3 años
padre
commit
1a97ee0c9f
Se han modificado 3 ficheros con 18 adiciones y 4 borrados
  1. 1 0
      CHANGE.md
  2. 17 4
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -5,6 +5,7 @@ Change Log: `bootstrap-fileinput`
 
 
 **Date**: _under development_
 **Date**: _under development_
 
 
+- (enh #1735): Correct file caption reset after thumbnail delete.
 - (bug #1734): Correct zoom data refresh for each individual file upload.
 - (bug #1734): Correct zoom data refresh for each individual file upload.
 - (enh #1731): Enhance RTL Styling for bootstrap 4/5 input groups.
 - (enh #1731): Enhance RTL Styling for bootstrap 4/5 input groups.
 - (enh #1730): Enhancements for bootstrap input group styles.
 - (enh #1730): Enhancements for bootstrap input group styles.

+ 17 - 4
js/fileinput.js

@@ -3927,8 +3927,8 @@
         _resetCaption: function () {
         _resetCaption: function () {
             var self = this;
             var self = this;
             setTimeout(function () {
             setTimeout(function () {
-                var cap, n, chk = self.previewCache.count(true), len = self.fileManager.count(), file,
-                    incomplete = ':not(.file-preview-success):not(.file-preview-error)',
+                var cap = '', n, chk = self.previewCache.count(true), len = self.fileManager.count(), file,
+                    incomplete = ':not(.file-preview-success):not(.file-preview-error)', cfg,
                     hasThumb = self.showPreview && self.getFrames(incomplete).length;
                     hasThumb = self.showPreview && self.getFrames(incomplete).length;
                 if (len === 0 && chk === 0 && !hasThumb) {
                 if (len === 0 && chk === 0 && !hasThumb) {
                     self.reset();
                     self.reset();
@@ -3937,8 +3937,19 @@
                     if (n > 1) {
                     if (n > 1) {
                         cap = self._getMsgSelected(n);
                         cap = self._getMsgSelected(n);
                     } else {
                     } else {
-                        file = self.fileManager.getFirstFile();
-                        cap = file ? file.nameFmt : '_';
+                        if (len === 0) {
+                            cfg = self.initialPreviewConfig[0];
+                            cap = '';
+                            if (cfg) {
+                                cap = cfg.caption || cfg.filename || ''
+                            }
+                            if (!cap) {
+                                cap = self._getMsgSelected(n);
+                            }
+                        } else {
+                            file = self.fileManager.getFirstFile();
+                            cap = file ? file.nameFmt : '_';
+                        }
                     }
                     }
                     self._setCaption(cap);
                     self._setCaption(cap);
                 }
                 }
@@ -4000,6 +4011,8 @@
                         self._setCaption('');
                         self._setCaption('');
                         self.reset();
                         self.reset();
                         self.initialCaption = '';
                         self.initialCaption = '';
+                    } else {
+                        self._resetCaption();
                     }
                     }
                 };
                 };
             self._initZoomButton();
             self._initZoomButton();

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
js/fileinput.min.js


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio