Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,13 @@ export default {
},

imageContainerStyle() {
// Uploaded image in temporary message (use actual image size)
if (this.previewType === PREVIEW_TYPE.TEMPORARY && !this.isUploadEditor) {
return {}
}

// Fallback for loading mimeicons (preview for audio files is not provided)
if (this.file['preview-available'] !== 'yes' || this.file.mimetype.startsWith('audio/')) {
if (this.file['preview-available'] !== 'yes' || this.file.mimetype.startsWith('audio/') || this.failed) {
return {
width: this.smallPreview ? '32px' : '128px',
height: this.smallPreview ? '32px' : '128px',
Expand All @@ -293,12 +298,9 @@ export default {
const widthConstraint = this.smallPreview ? 32 : (this.mediumPreview ? 192 : 600)
const heightConstraint = this.smallPreview ? 32 : (this.mediumPreview ? 192 : 384)

// Fallback when no metadata available
// Actual size when no metadata available
if (!this.file.width || !this.file.height) {
return {
width: widthConstraint + 'px',
height: heightConstraint + 'px',
}
return {}
}

const sizeMultiplicator = Math.min(
Expand Down Expand Up @@ -587,8 +589,8 @@ export default {

.preview {
border-radius: var(--border-radius);
max-width: 100%;
max-height: 384px;
max-width: min(100%, 600px);
max-height: min(100%, 384px);
}

.preview-medium {
Expand Down