소스 검색

Fix #1420: Correct `preferIconicPreview` parsing

Kartik Visweswaran 6 년 전
부모
커밋
68fa2fafe2
3개의 변경된 파일7개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 0
      CHANGE.md
  2. 5 6
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 2 - 0
CHANGE.md

@@ -5,7 +5,9 @@ Change Log: `bootstrap-fileinput`
 
 **Date:** _under development_
 
+- (enh #1420): Correct `preferIconicPreview` parsing.
 - (bug #1413): Correct `getFileStack` and `getFileList` methods.
+- Implement sponsorship.
 - Implement sentiment bot.
 
 ## version 5.0.3

+ 5 - 6
js/fileinput.js

@@ -2086,10 +2086,10 @@
                     });
                 }
             }
-            return out;
+            return out || self.previewFileIcon;
         },
         _parseFilePreviewIcon: function (content, fname) {
-            var self = this, icn = self._getPreviewIcon(fname) || self.previewFileIcon, out = content;
+            var self = this, icn = self._getPreviewIcon(fname), out = content;
             if (out.indexOf('{previewFileIcon}') > -1) {
                 out = out.setTokens({'previewFileIconClass': self.previewFileIconClass, 'previewFileIcon': icn});
             }
@@ -3683,11 +3683,10 @@
         ) {
             var self = this, caption = self.slug(fname), prevContent, zoomContent = '', styleAttribs = '',
                 screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
-                config, newCat = self.preferIconicPreview ? 'other' : cat, title = caption, alt = caption,
+                config, title = caption, alt = caption, typeCss = 'type-default', getContent,
                 footer = foot || self._renderFileFooter(cat, caption, size, 'auto', isError),
-                hasIconSetting = self._getPreviewIcon(fname), typeCss = 'type-default',
-                forcePrevIcon = hasIconSetting && self.preferIconicPreview,
-                forceZoomIcon = hasIconSetting && self.preferIconicZoomPreview, getContent;
+                forcePrevIcon = self.preferIconicPreview, forceZoomIcon = self.preferIconicZoomPreview,
+                newCat = forcePrevIcon ? 'other' : cat;
             config = screenW < 400 ? (self.previewSettingsSmall[newCat] || self.defaults.previewSettingsSmall[newCat]) :
                 (self.previewSettings[newCat] || self.defaults.previewSettings[newCat]);
             if (config) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
js/fileinput.min.js


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.