mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
UX: oneboxes with avatars now display consistently
Onebox avatar size is reduced to 60px Also fixes regression with some oneboxes not cooking after post
This commit is contained in:
@ -326,7 +326,11 @@ class CookedPostProcessor
|
||||
# and wrap in a div
|
||||
oneboxed_images.each do |img|
|
||||
limit_size!(img)
|
||||
if img.parent["class"].include?("onebox-body") && (width = img["width"].to_i) > 0 && (height = img["height"].to_i) > 0
|
||||
|
||||
next if img["class"]&.include?('onebox-avatar')
|
||||
|
||||
parent_class = img.parent && img.parent["class"]
|
||||
if parent_class&.include?("onebox-body") && (width = img["width"].to_i) > 0 && (height = img["height"].to_i) > 0
|
||||
img.delete('width')
|
||||
img.delete('height')
|
||||
new_parent = img.add_next_sibling("<div class='aspect-image' style='--aspect-ratio:#{width}/#{height};'/>")
|
||||
|
Reference in New Issue
Block a user