mirror of
https://github.com/discourse/discourse.git
synced 2025-08-21 19:11:18 +08:00
FIX: get vimeo URL from data-original-href
iframe attribute
This commit is contained in:
parent
bcca2b5d73
commit
66582ed956
1 changed files with 7 additions and 2 deletions
|
@ -375,8 +375,13 @@ module PrettyText
|
|||
|
||||
def self.convert_vimeo_iframes(doc)
|
||||
doc.css("iframe[src*='player.vimeo.com']").each do |iframe|
|
||||
vimeo_id = iframe['src'].split('/').last
|
||||
iframe.replace "<p><a href='https://vimeo.com/#{vimeo_id}'>https://vimeo.com/#{vimeo_id}</a></p>"
|
||||
if iframe["data-original-href"].present?
|
||||
vimeo_url = iframe["data-original-href"]
|
||||
else
|
||||
vimeo_id = iframe['src'].split('/').last
|
||||
vimeo_url = "https://vimeo.com/#{vimeo_id}"
|
||||
end
|
||||
iframe.replace "<p><a href='#{vimeo_url}'>#{vimeo_url}</a></p>"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue