فهرست منبع

Fix #1780: Correct `autoReplace` behavior to clear already uploaded thumbnails

Kartik Visweswaran 3 سال پیش
والد
کامیت
aff4b0d017
5فایلهای تغییر یافته به همراه51 افزوده شده و 41 حذف شده
  1. 2 1
      CHANGE.md
  2. 7 7
      README.md
  3. 33 33
      composer.json
  4. 9 0
      js/fileinput.js
  5. 0 0
      js/fileinput.min.js

+ 2 - 1
CHANGE.md

@@ -3,13 +3,14 @@ Change Log: `bootstrap-fileinput`
 
 ## version 5.2.8
 
-**Date**: _under development_
+**Date**: 10-May-2022
 
 - (enh #1787): Enhance image size validation messages.
 - (enh #1786): Correct Uzbek Cyrillic Translation file name.
 - (enh #1784): Correct documentation for `layoutTemplates.fileIcon`.
 - (bug #1783): Correct image size validation checks (for min and max width/height).
 - (enh #1782): Correct loading indicator reset for file selection.
+- (bug #1780): Correct `autoReplace` behavior to clear already uploaded thumbnails.
 - (enh #1779): New plugin method `showUserError` and new event `fileusererror`. 
   Usage:
 ```js

+ 7 - 7
README.md

@@ -92,34 +92,34 @@ Step 1: Load the following assets on your page in the order mentioned.
 <!-- link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css" crossorigin="anonymous" -->
 
 <!-- the fileinput plugin styling CSS file -->
-<link href="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].7/css/fileinput.min.css" media="all" rel="stylesheet" type="text/css" />
+<link href="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].8/css/fileinput.min.css" media="all" rel="stylesheet" type="text/css" />
 
 <!-- if using RTL (Right-To-Left) orientation, load the RTL CSS file after fileinput.css by uncommenting below -->
-<!-- link href="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].7/css/fileinput-rtl.min.css" media="all" rel="stylesheet" type="text/css" /-->
+<!-- link href="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].8/css/fileinput-rtl.min.css" media="all" rel="stylesheet" type="text/css" /-->
 
 <!-- the jQuery Library -->
 <script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
 
 <!-- piexif.min.js is needed for auto orienting image files OR when restoring exif data in resized images and when you
     wish to resize images before upload. This must be loaded before fileinput.min.js -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].7/js/plugins/piexif.min.js" type="text/javascript"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].8/js/plugins/piexif.min.js" type="text/javascript"></script>
 
 <!-- sortable.min.js is only needed if you wish to sort / rearrange files in initial preview. 
     This must be loaded before fileinput.min.js -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].7/js/plugins/sortable.min.js" type="text/javascript"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].8/js/plugins/sortable.min.js" type="text/javascript"></script>
 
 <!-- bootstrap.bundle.min.js below is needed if you wish to zoom and preview file content in a detail modal
     dialog. bootstrap 5.x or 4.x is supported. You can also use the bootstrap js 3.3.x versions. -->
 <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
 
 <!-- the main fileinput plugin script JS file -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].7/js/fileinput.min.js"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].8/js/fileinput.min.js"></script>
 
 <!-- following theme script is needed to use the Font Awesome 5.x theme (`fas`). Uncomment if needed. -->
-<!-- script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].7/themes/fas/theme.min.js"></script -->
+<!-- script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].8/themes/fas/theme.min.js"></script -->
 
 <!-- optionally if you need translation for your language then include the locale file as mentioned below (replace LANG.js with your language locale) -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].7/js/locales/LANG.js"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected].8/js/locales/LANG.js"></script>
 ```
 With v5.2.1, the plugin is able to automatically detect the bootstrap library version and deliver the relevant bootstrap specific functionality (if you have loaded the bootstrap.min.js before fileinput.min.js). In case of any issues - you can explicitly set the bootstrap version by setting the following variable before the plugin initialization script.
 

+ 33 - 33
composer.json

@@ -1,36 +1,36 @@
 {
-    "name": "kartik-v/bootstrap-fileinput",
-    "description": "An enhanced HTML 5 file input for Bootstrap 5.x, 4.x, and 3.x with features for file preview for many file types, multiple selection, ajax uploads, and more.",
-    "keywords": [
-        "bootstrap",
-        "jquery",
-        "file",
-        "input",
-        "preview",
-        "upload",
-        "image",
-        "multiple",
-        "ajax",
-        "delete",
-        "progress"
-    ],
-    "homepage": "https://github.com/kartik-v/bootstrap-fileinput",
-    "license": "BSD-3-Clause",
-    "authors": [
-        {
-            "name": "Kartik Visweswaran",
-            "email": "[email protected]",
-            "homepage": "http://www.krajee.com/"
-        }
-    ],
-    "autoload": {
-        "psr-4": {
-            "kartik\\plugins\\fileinput\\": ""
-        }
-    },
-    "extra": {
-        "branch-alias": {
-            "dev-master": "5.2.x-dev"
-        }
+  "name": "kartik-v/bootstrap-fileinput",
+  "description": "An enhanced HTML 5 file input for Bootstrap 5.x, 4.x, and 3.x with features for file preview for many file types, multiple selection, ajax uploads, and more.",
+  "keywords": [
+    "bootstrap",
+    "jquery",
+    "file",
+    "input",
+    "preview",
+    "upload",
+    "image",
+    "multiple",
+    "ajax",
+    "delete",
+    "progress"
+  ],
+  "homepage": "https://github.com/kartik-v/bootstrap-fileinput",
+  "license": "BSD-3-Clause",
+  "authors": [
+    {
+      "name": "Kartik Visweswaran",
+      "email": "[email protected]",
+      "homepage": "http://www.krajee.com/"
     }
+  ],
+  "autoload": {
+    "psr-4": {
+      "kartik\\plugins\\fileinput\\": ""
+    }
+  },
+  "extra": {
+    "branch-alias": {
+      "dev-master": "5.2.x-dev"
+    }
+  }
 }

+ 9 - 0
js/fileinput.js

@@ -5195,6 +5195,7 @@
                 if (total > maxCount) {
                     self._resetPreviewThumbs(isAjaxUpload);
                 }
+
             } else {
                 if (inclAll) {
                     total = self._getFileCount(initCount, true);
@@ -5219,6 +5220,14 @@
                     }
                 }
             }
+            if (self.autoReplace) {
+                self._getThumbs().each(function() {
+                    var $thumb = $(this);
+                    if ($thumb.hasClass('file-preview-success') || $thumb.hasClass('file-preview-error')) {
+                        $thumb.remove();
+                    }
+                });
+            }
             self.readFiles(tfiles);
             self._toggleLoading('hide');
         },

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
js/fileinput.min.js


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است