diff --git a/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue b/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue index ced1222d7a2..ffb34930c9f 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue +++ b/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue @@ -50,9 +50,10 @@ alt="" :src="defaultIconUrl"> - + class="preview loading" + :style="imageContainerStyle" /> this.height ? 1 : (heightConstraint / this.height)), + (widthConstraint > this.width ? 1 : (widthConstraint / this.width)) + ) + + return { + width: this.width * sizeMultiplicator + 'px', + aspectRatio: this.width + '/' + this.height, + } + }, + previewType() { if (this.hasTemporaryImageUrl) { return PREVIEW_TYPE.TEMPORARY @@ -529,10 +584,7 @@ export default { .file-preview { position: relative; min-width: 0; - width: 100%; - /* The file preview can not be a block; otherwise it would fill the whole - width of the container and the loading icon would not be centered on the - image. */ + max-width: 100%; display: inline-block; border-radius: 16px; @@ -560,7 +612,8 @@ export default { .loading { display: inline-block; - width: 100%; + min-width: 32px; + background-color: var(--color-background-dark); } .mimeicon { @@ -594,7 +647,8 @@ export default { } .image-container { - display: flex; + position: relative; + display: inline-flex; height: 100%; &.playable {