UX: stop warping tiny onebox images

This commit is contained in:
Sam 2017-11-28 12:32:35 +11:00
parent ceaadf6246
commit b3b55e18d1
2 changed files with 15 additions and 4 deletions

View File

@ -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 {

View File

@ -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