mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 06:51:27 +08:00
FEATURE: fallback to image alt before filename if there's no title in lightboxes (#8286)
* use image alt as a fallback when there's no title * update spec we used to check that the overlay information is added when the image has a titie. This adds 2 more scenarios. One where an image has both a title and an alt, in which case the title should be used and alt ignored. The other is when there's only an alt, it should then be used to generate the overlay
This commit is contained in:
@ -426,7 +426,7 @@ class CookedPostProcessor
|
||||
informations = +"#{original_width}×#{original_height}"
|
||||
informations << " #{upload.human_filesize}" if upload
|
||||
|
||||
a["title"] = CGI.escapeHTML(img["title"] || filename)
|
||||
a["title"] = CGI.escapeHTML(img["title"] || img["alt"] || filename)
|
||||
|
||||
meta.add_child create_icon_node("far-image")
|
||||
meta.add_child create_span_node("filename", a["title"])
|
||||
|
Reference in New Issue
Block a user