Sha256: 758011ac1a49f8ff805f9573ba40e15d7e1f6d06e75499e3ae80c196c114cc5a

Contents?: true

Size: 584 Bytes

Versions: 8

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

module EffectiveArticleEditorHelper

  def render_article_editor_action_text_content(content)
    raise('expected content to be an content') unless content.kind_of?(ActionText::Content)

    rendered = render_action_text_content(content)

    if rendered.include?('effective-article-editor')
      doc = Nokogiri::HTML(rendered)
      doc.search('action-text-attachment').each { |fragment| fragment.remove }

      # Filter out <html><body>\n and \n</body></html>
      rendered = doc.inner_html.to_s[13..-16].html_safe
    end

    rendered
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
effective_bootstrap-0.10.17 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.10.16 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.10.15 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.10.14 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.10.13 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.10.12 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.10.11 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.10.10 app/helpers/effective_article_editor_helper.rb