Ver Fonte

Fix #898: New plugin method to get files in preview and config

Kartik Visweswaran há 8 anos atrás
pai
commit
9a3773ef56
3 ficheiros alterados com 12 adições e 11 exclusões
  1. 2 1
      CHANGE.md
  2. 10 10
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 2 - 1
CHANGE.md

@@ -3,7 +3,7 @@ Change Log: `bootstrap-fileinput`
 
 ## version 4.3.9
 
-**Date:** 06-Mar-2017 (_under development_)
+**Date:** 07-Mar-2017 (_under development_)
 
 1. (enh #863): New plugin method `zoom` with parameter `frameId` to allow custom triggering of zoomed preview for each thumbnail frame.
 2. (enh #881): Update Spanish Translations.
@@ -17,6 +17,7 @@ Change Log: `bootstrap-fileinput`
 10. (bug #890): Fix doubling of images for async bulk uploads when initial preview is returned via ajax response.
 11. (bug #893): Correct `file-success-remove` event handling.
 12. (enh #894, #895): Correct file size validation for empty files.
+13. (enh #898): New plugin method to get files in preview and config.
 
 ## version 4.3.8
 

+ 10 - 10
js/fileinput.js

@@ -2074,11 +2074,7 @@
                     }
                 });
                 if (self.uploadAsync) {
-                    self.cacheInitialPreview = {
-                        content: self.initialPreview,
-                        config: self.initialPreviewConfig,
-                        tags: self.initialPreviewThumbTags
-                    };
+                    self.cacheInitialPreview = self.getPreview();
                 }
             }
         },
@@ -3295,11 +3291,7 @@
                 }
                 self.$preview.find('.file-preview-initial').removeClass($h.SORT_CSS);
                 self._initSortable();
-                self.cacheInitialPreview = {
-                    content: self.initialPreview,
-                    config: self.initialPreviewConfig,
-                    tags: self.initialPreviewThumbTags
-                };
+                self.cacheInitialPreview = self.getPreview();
                 for (i = 0; i < len; i++) {
                     if (self.filestack[i] !== undefined) {
                         self._uploadSingle(i, self.filestack, true);
@@ -3342,6 +3334,14 @@
             self._setZoomContent($frame);
             $modal.modal('show');
             self._initZoomButtons();
+        },
+        getPreview: function() {
+            var self = this;
+            return {
+                content: self.initialPreview,
+                config: self.initialPreviewConfig,
+                tags: self.initialPreviewThumbTags
+            };
         }
     };
 

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
js/fileinput.min.js


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff