Просмотр исходного кода

Fix #1580: Correctly validate drop zone title

Kartik Visweswaran 4 лет назад
Родитель
Сommit
ccdd37d702
3 измененных файлов с 6 добавлено и 1 удалено
  1. 1 0
      CHANGE.md
  2. 5 1
      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_
 
+- (enh #1580): Validate drop zone title by correctly checking if native input has files.
 - (enh #1578): Enhance progress bar styling.
 - (enh #1577): Use `…` instead of three dots.
 - (enh #1576): Update French Translations.

+ 5 - 1
js/fileinput.js

@@ -4250,6 +4250,10 @@
                 }
             }
         },
+        _hasFiles: function () {
+            var el = this.$element.get(0);
+            return !!(el && el.files && el.files.length);
+        },
         _setFileDropZoneTitle: function () {
             var self = this, $zone = self.$container.find('.file-drop-zone'), title = self.dropZoneTitle, strFiles;
             if (self.isClickable) {
@@ -4258,7 +4262,7 @@
             }
             $zone.find('.' + self.dropZoneTitleClass).remove();
             if (!self.showPreview || $zone.length === 0 || self.fileManager.count() > 0 || !self.dropZoneEnabled ||
-                (!self.isAjaxUpload && self.$element.files)) {
+                (!self.isAjaxUpload && self._hasFiles())) {
                 return;
             }
             if ($zone.find($h.FRAMES).length === 0 && $h.isEmpty(self.defaultPreviewContent)) {

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
js/fileinput.min.js


Некоторые файлы не были показаны из-за большого количества измененных файлов