Module: EffectiveArticleEditorHelper

Defined in:
app/helpers/effective_article_editor_helper.rb

Constant Summary collapse

ACTION_TEXT_ATTACHMENTS =
Regexp.new("<action-text-attachment.*?<\/action-text-attachment>")

Instance Method Summary collapse

Instance Method Details

#render_article_editor_action_text_content(content) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/effective_article_editor_helper.rb', line 6

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')
    rendered.gsub!(ACTION_TEXT_ATTACHMENTS, '')
  end

  rendered.html_safe
end