Module: Integral::LazyContentable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/integral/lazy_contentable.rb
Overview
Enable lazy loading WYSIWYG content
Instance Method Summary collapse
-
#editor_body ⇒ String
Body HTML ready for WYSIWYG editor.
Instance Method Details
#editor_body ⇒ String
Returns body HTML ready for WYSIWYG editor.
12 13 14 15 16 17 18 19 20 21 |
# File 'app/models/concerns/integral/lazy_contentable.rb', line 12 def editor_body html = Nokogiri::HTML(body) # Remove image lazyloading html.css('img.lazyload').each do |element| element.attributes['src'].value = element.attributes['data-src'].value end html.css('body').inner_html end |