Detect <img> images in markdown rich text

This commit is contained in:
Anton Khorev 2024-08-02 20:01:52 +03:00
parent 3cc0458468
commit 25aea657e2
2 changed files with 7 additions and 1 deletions

View file

@ -104,7 +104,8 @@ module RichText
end
def first_image_element(element)
return element if element.type == :img
return element if element.type == :img ||
(element.type == :html_element && element.value == "img")
element.children.find do |child|
nested_image = first_image_element(child)