mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
UX: stop warping tiny onebox images
This commit is contained in:
parent
ceaadf6246
commit
b3b55e18d1
|
@ -141,6 +141,12 @@ aside.onebox {
|
|||
width: auto;
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
&.onebox-full-image {
|
||||
max-height: none;
|
||||
max-width: none;
|
||||
width: initial;
|
||||
height: initial;
|
||||
}
|
||||
}
|
||||
|
||||
[style*="--aspect-ratio"] > :first-child {
|
||||
|
|
|
@ -422,10 +422,15 @@ class CookedPostProcessor
|
|||
end
|
||||
end
|
||||
|
||||
img.delete('width')
|
||||
img.delete('height')
|
||||
new_parent = img.add_next_sibling("<div class='aspect-image' style='--aspect-ratio:#{width}/#{height};'/>")
|
||||
new_parent.first.add_child(img)
|
||||
if width < 64 && height < 64
|
||||
img["class"] = img["class"].to_s + " onebox-full-image"
|
||||
else
|
||||
img.delete('width')
|
||||
img.delete('height')
|
||||
new_parent = img.add_next_sibling("<div class='aspect-image' style='--aspect-ratio:#{width}/#{height};'/>")
|
||||
new_parent.first.add_child(img)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user