소스 검색

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.
 18. (enh #909): Update German Translations.
 19. More correct validation of `allowedFileTypes` to accept null values.
 19. More correct validation of `allowedFileTypes` to accept null values.
 20. Enhance zoom preview styling for Krajee Explorer theme.
 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
 ## version 4.3.8
 
 

+ 6 - 3
js/fileinput.js

@@ -3116,8 +3116,9 @@
         _resetFileStack: function () {
         _resetFileStack: function () {
             var self = this, i = 0, newstack = [], newnames = [], newids = [];
             var self = this, i = 0, newstack = [], newnames = [], newids = [];
             self._getThumbs().each(function () {
             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;
                     return;
                 }
                 }
                 if (file !== undefined) {
                 if (file !== undefined) {
@@ -3127,7 +3128,9 @@
                     $thumb.attr({'id': self.previewInitId + '-' + i, 'data-fileindex': i});
                     $thumb.attr({'id': self.previewInitId + '-' + i, 'data-fileindex': i});
                     i++;
                     i++;
                 } else {
                 } 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;
             self.filestack = newstack;

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
js/fileinput.min.js


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.