summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2016-12-01 21:14:10 +0100
committerGitHub <noreply@github.com>2016-12-01 21:14:10 +0100
commit61d61e794c9f3386757572431dced77474bb7c3f (patch)
treed3a8dd0b7d9f1912b1074e4b3aef0c9de780edc4 /apps/files
parentbe1b2b723fcf510c6b12da6e2f7dd5be9f768895 (diff)
parenta4900bf23fb7b3aca8e773926322742e8ccf0c3a (diff)
downloadnextcloud-server-61d61e794c9f3386757572431dced77474bb7c3f.tar.gz
nextcloud-server-61d61e794c9f3386757572431dced77474bb7c3f.zip
Merge pull request #2435 from nextcloud/sidebar-preview-non-preview
allow registering sidebar preview handlers for mimetypes that dont co…
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/sidebarpreviewmanager.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/files/js/sidebarpreviewmanager.js b/apps/files/js/sidebarpreviewmanager.js
index 3d540119189..2cf4248897a 100644
--- a/apps/files/js/sidebarpreviewmanager.js
+++ b/apps/files/js/sidebarpreviewmanager.js
@@ -20,19 +20,28 @@
this._previewHandlers[mime] = handler;
},
- getPreviewHandler: function (mime) {
+ getMimeTypePreviewHandler: function(mime) {
var mimePart = mime.split('/').shift();
if (this._previewHandlers[mime]) {
return this._previewHandlers[mime];
- } else if(this._previewHandlers[mimePart]) {
+ } else if (this._previewHandlers[mimePart]) {
return this._previewHandlers[mimePart];
} else {
+ return null;
+ }
+ },
+
+ getPreviewHandler: function (mime) {
+ var mimetypeHandler = this.getMimeTypePreviewHandler(mime);
+ if (mimetypeHandler) {
+ return mimetypeHandler;
+ } else {
return this.fallbackPreview.bind(this);
}
},
loadPreview: function (model, $thumbnailDiv, $thumbnailContainer) {
- if (model.get('hasPreview') === false) {
+ if (model.get('hasPreview') === false && this.getMimeTypePreviewHandler(model.get('mimetype')) === null) {
var mimeIcon = OC.MimeType.getIconUrl(model.get('mimetype'));
$thumbnailDiv.removeClass('icon-loading icon-32');
$thumbnailContainer.removeClass('image'); //fall back to regular view