Ensure backwards compatibility with Trix

This commit is contained in:
Stanko K.R.
2026-07-20 17:56:05 +02:00
parent a3d2939569
commit bfb57a23f9
8 changed files with 86 additions and 9 deletions
+3 -2
View File
@@ -33,12 +33,13 @@ class ActionText::Attachment::OpengraphEmbed
def attributes_from_content(content)
fragment = Nokogiri::HTML.fragment(content)
link = fragment.at_css(".og-embed__title a")
title = fragment.at_css(".og-embed__title")
link = title&.at_css("a")
{
href: link&.[]("href"),
url: fragment.at_css(".og-embed__image img")&.[]("src"),
filename: link&.text&.strip,
filename: (link || title)&.text&.strip,
description: fragment.at_css(".og-embed__description")&.text&.strip
}
end