瀏覽代碼

Fix #913: Better id parsing and resetting of uploaded file thumbnails

Kartik Visweswaran 8 年之前
父節點
當前提交
5515c0fca8
共有 3 個文件被更改,包括 7 次插入3 次删除
  1. 1 0
      CHANGE.md
  2. 6 3
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -25,6 +25,7 @@ Change Log: `bootstrap-fileinput`
 18. (enh #909): Update German Translations.
 19. More correct validation of `allowedFileTypes` to accept null values.
 20. Enhance zoom preview styling for Krajee Explorer theme.
+21. (enh #913): Better id parsing and resetting of uploaded file thumbnails.
 
 ## version 4.3.8
 

+ 6 - 3
js/fileinput.js

@@ -3116,8 +3116,9 @@
         _resetFileStack: function () {
             var self = this, i = 0, newstack = [], newnames = [], newids = [];
             self._getThumbs().each(function () {
-                var $thumb = $(this), ind = $thumb.attr('data-fileindex'), file = self.filestack[ind];
-                if (ind === -1) {
+                var $thumb = $(this), ind = $thumb.attr('data-fileindex'), file = self.filestack[ind],
+                    pid = $thumb.attr('id'), newId;
+                if (ind === '-1' || ind === -1) {
                     return;
                 }
                 if (file !== undefined) {
@@ -3127,7 +3128,9 @@
                     $thumb.attr({'id': self.previewInitId + '-' + i, 'data-fileindex': i});
                     i++;
                 } else {
-                    $thumb.attr({'data-fileindex': '-1'});
+                    newId = 'uploaded-' + $h.uniqId();
+                    $thumb.attr({'id': newId, 'data-fileindex': '-1'});
+                    self.$preview.find('#zoom-' + pid).attr('id', 'zoom-' + newId);
                 }
             });
             self.filestack = newstack;

文件差異過大導致無法顯示
+ 0 - 0
js/fileinput.min.js


部分文件因文件數量過多而無法顯示