Browse Source

fix: drop event will not trigger excelPreview @ init

Hugh Harlequin 1 year ago
parent
commit
c9556f5097
2 changed files with 6 additions and 1 deletions
  1. 0 0
      js/dist/excel-preview.min.js
  2. 6 1
      js/src/excel-preview.js

File diff suppressed because it is too large
+ 0 - 0
js/dist/excel-preview.min.js


+ 6 - 1
js/src/excel-preview.js

@@ -32,7 +32,12 @@
         init: function () {
         init: function () {
             var e = this;
             var e = this;
             let input = $(e.element).prev('input[type=file]');
             let input = $(e.element).prev('input[type=file]');
-            $(e.element).prev('input[type=file]').fileinput(e.settings).on('change', function (file) {
+            let namespace = input.data('fileinput').namespace;
+            input.fileinput(e.settings).on('change', function (file) {
+                e.excelPreview(file);
+            })
+            /* let drop event trigger change*/
+            input.on('change' + namespace, function (file){
                 e.excelPreview(file);
                 e.excelPreview(file);
             })
             })
         },
         },

Some files were not shown because too many files changed in this diff