mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 23:54:02 +08:00
df7dab9dce
Prior to this fix we would output an image with no width/height which would then bypass a large part of `CookedProcessorMixin` and have no aspect ratio. As a result, an image with no size would cause layout shift. It also removes a fix for oneboxes in chat messages due to this case.
83 lines
1.7 KiB
SCSS
83 lines
1.7 KiB
SCSS
$max_image_height: 150px;
|
|
|
|
.chat-message {
|
|
// append selectors to set images to a
|
|
// max height of $max_image_height
|
|
.onebox img:not(.ytp-thumbnail-image, .onebox-avatar-inline),
|
|
img.onebox,
|
|
.chat-uploads img,
|
|
p img,
|
|
aside.onebox .onebox-body .aspect-image-full-size,
|
|
aside.onebox .onebox-body .aspect-image-full-size img,
|
|
.chat-message-text p img:not(.emoji) {
|
|
object-fit: contain;
|
|
max-height: $max_image_height;
|
|
max-width: 100%;
|
|
width: unset;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.onebox {
|
|
container-type: inline-size;
|
|
|
|
.thumbnail {
|
|
&.onebox-avatar {
|
|
max-height: 100px;
|
|
width: 20%;
|
|
max-width: 60px;
|
|
margin-right: 0.5rem;
|
|
}
|
|
}
|
|
|
|
@container (width < 400px) {
|
|
.onebox-body {
|
|
&:not(:has(.thumbnail.onebox-avatar)) {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
h3 {
|
|
margin-block: 0.75rem 0;
|
|
}
|
|
p {
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
.thumbnail {
|
|
max-width: 100% !important;
|
|
margin: 0;
|
|
|
|
&.onebox-avatar {
|
|
max-width: 20%;
|
|
margin-right: 0.5rem;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.chat-message-collapser
|
|
.chat-message-collapser-header
|
|
+ div
|
|
.chat-message-collapser-lazy-video {
|
|
object-fit: contain;
|
|
max-height: $max_image_height;
|
|
max-width: calc(#{$max_image_height} / 9 * 16);
|
|
}
|
|
|
|
// Prevent overflow of old lazy-yt images
|
|
// TODO: remove in December 2023
|
|
.lazyYT.lazyYT-container {
|
|
border: none;
|
|
a {
|
|
display: flex;
|
|
}
|
|
.ytp-thumbnail-image {
|
|
object-fit: contain;
|
|
height: $max_image_height;
|
|
width: calc(#{$max_image_height} / 9 * 16);
|
|
pointer-events: none;
|
|
}
|
|
}
|
|
}
|