Sha256: cfbe91d5ecb875fff0d59ed206d9eb68c2cbd095e01b07e96b1005dffee81a44

Contents?: true

Size: 575 Bytes

Versions: 14

Compression:

Stored size: 575 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 = content.to_html

    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]
    end

    rendered.html_safe
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
effective_bootstrap-0.12.1 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.12.0 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.22 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.21 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.20 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.19 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.18 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.17 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.16 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.15 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.14 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.13 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.12 app/helpers/effective_article_editor_helper.rb
effective_bootstrap-0.11.11 app/helpers/effective_article_editor_helper.rb