mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 10:43:57 +08:00
FIX: get vimeo URL from data-original-href
iframe attribute
This commit is contained in:
parent
bcca2b5d73
commit
66582ed956
|
@ -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…
Reference in New Issue
Block a user