Fix: File preview not visible if initialized in background

This commit is contained in:
buddh4 2020-11-02 19:50:42 +01:00
parent 6445f151cf
commit 9cad6a8196
2 changed files with 5 additions and 2 deletions

View File

@ -353,7 +353,8 @@ humhub.module('file', function (module, require, $) {
that.add(file) that.add(file)
}); });
if(!this.$.find('.file-preview-item:visible').length) { // Note we are not using :visible since the preview itself may not visible on init
if(!this.$.find('.file-preview-item:not(.hiddenFile)').length) {
this.$.hide(); this.$.hide();
} }
}; };
@ -406,6 +407,8 @@ humhub.module('file', function (module, require, $) {
if(!(this.isMedia(file) && this.options.excludeMediaFilesPreview)) { if(!(this.isMedia(file) && this.options.excludeMediaFilesPreview)) {
$file.fadeIn(); $file.fadeIn();
} else {
$file.addClass('hiddenFile');
} }
}; };

View File

@ -94,7 +94,7 @@ class FilePreview extends JsWidget
'prevent-popover' => $this->preventPopover, 'prevent-popover' => $this->preventPopover,
'popover-position' => $this->popoverPosition, 'popover-position' => $this->popoverPosition,
'file-edit' => $this->edit, 'file-edit' => $this->edit,
'exclude-media-files-preview' => $this->excludeMediaFilesPreview 'exclude-media-files-preview' => (int) $this->excludeMediaFilesPreview
]; ];
} }