Explorar o código

Updates to release v4.4.0 fixes #917 fixes #919

Kartik Visweswaran %!s(int64=8) %!d(string=hai) anos
pai
achega
b91cbacfce
Modificáronse 5 ficheiros con 58 adicións e 18 borrados
  1. 2 0
      CHANGE.md
  2. 31 3
      css/fileinput.css
  3. 0 0
      css/fileinput.min.css
  4. 25 15
      js/fileinput.js
  5. 0 0
      js/fileinput.min.js

+ 2 - 0
CHANGE.md

@@ -9,6 +9,8 @@ Change Log: `bootstrap-fileinput`
 2. (enh #915): Update default styling for zoom preview for object.
 3. Parse all numeric properties correctly.
 4. (enh #917): Better default styling for zoom preview for object (corrects #915).
+5. (bug #919): Fix resize validation.
+6. (enh #920): Cancel ajax abort action more correctly.
 
 ## version 4.3.9
 

+ 31 - 3
css/fileinput.css

@@ -433,16 +433,44 @@
     right: 1px;
 }
 
-.file-zoom-content {
+.file-zoom-content.krajee-default {
     height: 480px;
     text-align: center;
 }
 
-.file-zoom-content .file-preview-image, .file-preview-
-.file-zoom-content .file-preview-video {
+.file-zoom-content.krajee-default .file-preview-image,
+.file-zoom-content.krajee-default .file-preview-video {
     max-height: 100%
 }
 
+.file-zoom-content.krajee-default > .file-object.type-image {
+    width: auto;
+    height: auto;
+    min-height: inherit;
+    max-width: 100%;
+    max-height: 100%;
+}
+
+.file-zoom-content.krajee-default > .file-object.type-video,
+.file-zoom-content.krajee-default > .file-object.type-flash {
+    width: auto;
+    height: 100%;
+    max-width: 100%;
+    max-height: 100%;
+}
+
+.file-zoom-content.krajee-default > .file-object.type-audio {
+    width: auto;
+    height: 30px;
+}
+
+.file-zoom-content.krajee-default > .file-object.type-pdf,
+.file-zoom-content.krajee-default > .file-object.type-html,
+.file-zoom-content.krajee-default > .file-object.type-text,
+.file-zoom-content.krajee-default > .file-object.type-default {
+    width: 100%;
+}
+
 .file-preview-initial.sortable-chosen {
     background-color: #d9edf7;
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
css/fileinput.min.css


+ 25 - 15
js/fileinput.js

@@ -446,7 +446,7 @@
             tFlash = '<object class="kv-preview-data file-object" type="application/x-shockwave-flash" ' +
                 'width="{width}" height="{height}" data="{data}">\n' + $h.OBJECT_PARAMS + ' ' + $h.DEFAULT_PREVIEW +
                 '\n</object>\n';
-            tObject = '<object class="kv-preview-data file-object" data="{data}" type="{type}" ' +
+            tObject = '<object class="kv-preview-data file-object {typeCss}" data="{data}" type="{type}" ' +
                 'width="{width}" height="{height}">\n' + '<param name="movie" value="{caption}" />\n' +
                 $h.OBJECT_PARAMS + ' ' + $h.DEFAULT_PREVIEW + '\n</object>\n';
             tPdf = '<embed class="kv-preview-data" src="{data}" ' +
@@ -500,10 +500,10 @@
                     image: {width: "auto", height: "160px"},
                     html: {width: "213px", height: "160px"},
                     text: {width: "213px", height: "160px"},
-                    video: {width: "213px", height: "160px"},
-                    audio: {width: "213px", height: "80px"},
-                    flash: {width: "213px", height: "160px"},
-                    object: {width: "160px", height: "auto"},
+                    video: {width: "auto", height: "100%", 'max-width': "100%"},
+                    audio: {width: "100%", height: "30px"},
+                    flash: {width: "auto", height: "100%", 'max-width': "100%"},
+                    object: {height: "100%"},
                     pdf: {width: "160px", height: "160px"},
                     other: {width: "160px", height: "160px"}
                 },
@@ -2278,7 +2278,7 @@
                 config = self.previewSettings[cat] || self.defaults.previewSettings[cat],
                 w = config && config.width ? config.width : '', h = config && config.height ? config.height : '',
                 footer = foot || self._renderFileFooter(caption, size, ($h.isEmpty(w) ? 'auto' : w), isError),
-                hasIconSetting = self._getPreviewIcon(fname),
+                hasIconSetting = self._getPreviewIcon(fname), typeCss = 'type-default',
                 forcePrevIcon = hasIconSetting && self.preferIconicPreview,
                 forceZoomIcon = hasIconSetting && self.preferIconicZoomPreview,
                 getContent = function (c, d, zoom, frameCss) {
@@ -2294,9 +2294,19 @@
                     if (c === 'text') {
                         d = $h.htmlEncode(d);
                     }
+                    if (cat === 'object' && !ftype) {
+                        $.each(self.defaults.fileTypeSettings, function (key, func) {
+                            if (key === 'object' || key === 'other') {
+                                return;
+                            }
+                            if (func(fname, ftype)) {
+                                typeCss = 'type-' + key;
+                            }
+                        });
+                    }
                     return tmplt.replace(/\{previewId}/g, id).replace(/\{caption}/g, caption)
                         .replace(/\{frameClass}/g, css).replace(/\{type}/g, ftype).replace(/\{fileindex}/g, ind)
-                        .replace(/\{width}/g, w).replace(/\{height}/g, h)
+                        .replace(/\{width}/g, w).replace(/\{height}/g, h).replace(/\{typeCss}/g, typeCss)
                         .replace(/\{footer}/g, footer).replace(/\{data}/g, d).replace(/\{template}/g, templ || cat);
                 };
             ind = ind || previewId.slice(previewId.lastIndexOf('-') + 1);
@@ -2738,19 +2748,19 @@
                 }
                 self._raise('fileimageloaded', [previewId]);
                 self.loadedImages.push({
-                    ind: i, 
-                    img: $img, 
-                    thumb: $thumb, 
-                    pid: previewId, 
-                    typ: ftype, 
-                    siz: fsize, 
+                    ind: i,
+                    img: $img,
+                    thumb: $thumb,
+                    pid: previewId,
+                    typ: ftype,
+                    siz: fsize,
                     validated: false
                 });
                 self._validateAllImages();
             });
         },
         _validateAllImages: function () {
-            var self = this, i, counter = {val: 0}, numImgs = self.loadedImages.length, config, 
+            var self = this, i, counter = {val: 0}, numImgs = self.loadedImages.length, config,
                 fsize, minSize = self.resizeIfSizeMoreThan;
             if (numImgs !== self.totalImagesCount) {
                 return;
@@ -2765,7 +2775,7 @@
                     continue;
                 }
                 fsize = config.siz;
-                if (fsize && minSize && fsize > minSize * 1000) {
+                if (fsize && fsize > minSize * 1000) {
                     self._getResizedImage(config, counter, numImgs);
                 }
                 self.loadedImages[i].validated = true;

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
js/fileinput.min.js


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio