my app sends out emails. If there is a very long word or a long URL, it is breaking the email viewing experience by not letting the iphone zoom ad tighten in.
Here’s what I’ve come up with so far but it’s not working, thoughts?
Helper
def html_format(string, max_width=12)
text = string.gsub("\n", '<br />').html_safe.strip
(text.length < max_width) ?
text :
text.scan(/.{1,#{max_width}}/).join("<wbr>")
return text
end
View
<%= html_format(@comment.content) %>
Here’s a method I found online that seems to work well for splitting long strings with
<wbr>: