Sha256: e45c2ded1db50da0036aab1f85539340bf4b3e385208270e29adcb4a6eed0fd5

Contents?: true

Size: 595 Bytes

Versions: 11

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

module EffectiveArticleEditorHelper

  def render_article_editor_action_text_content(content)
    raise('expected content to be an ActionText 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

11 entries across 11 versions & 1 rubygems

Version Path
effective_bootstrap-0.11.10 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.9 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.8 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.7 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.6 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.5 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.4 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.3 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.2 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.1 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.0 app/helpers/effective_article_editor_helper.rb