It’s all happening in lib/email/styles.rb.
def onebox_styles
...
# iframes can't go in emails, so replace them with clickable links
@fragment.css('iframe').each do |i|
begin
src_uri = URI(i['src'])
# If an iframe is protocol relative, use SSL when displaying it
display_src = "#{src_uri.scheme || 'https://'}#{src_uri.host}#{src_uri.path}"
i.replace "<p><a href='#{src_uri.to_s}'>#{display_src}</a><p>"
rescue URI::InvalidURIError
# If the URL is weird, remove it
i.remove
end
end
You can add a plugin_callback to modify the html.
# this method is reserved for styles specific to plugin
def plugin_styles
@@plugin_callbacks.each { |block| block.call(@fragment, @opts) }
end
Unfortunately, plugin_styles is called after onebox_styles in the format_html method. If that order was reversed you could do what you want.
Doing any work with this file is slow because the methods are being cached by Sidekiq. To get around that I’ve been requiring sidekiq/testing at the start of 100-sidekiq.rb instead of sidekiq/pausable. To do that you have to comment out calls to Sidekiq.pause! in restorer.rb and backuper.rb.
The other option is to restart sidekiq every time you change the code.