Skip to Content Skip to Search
Methods
R
S

Instance Public methods

render_action_text_attachments(content)

# File actiontext/app/helpers/action_text/content_helper.rb, line 35
def render_action_text_attachments(content)
  content.render_attachments do |attachment|
    unless attachment.in?(content.gallery_attachments)
      attachment.node.tap do |node|
        node.inner_html = render_action_text_attachment attachment, locals: { in_gallery: false }
      end
    end
  end.render_attachment_galleries do |attachment_gallery|
    render(layout: attachment_gallery, object: attachment_gallery) do
      attachment_gallery.attachments.map do |attachment|
        attachment.node.inner_html = render_action_text_attachment attachment, locals: { in_gallery: true }
        attachment.to_html
      end.join.html_safe
    end.chomp
  end
end

render_action_text_content(content)

# File actiontext/app/helpers/action_text/content_helper.rb, line 12
def render_action_text_content(content)
  self.prefix_partial_path_with_controller_namespace = false
  sanitize_action_text_content(render_action_text_attachments(content))
end

sanitize_action_text_content(content)

# File actiontext/app/helpers/action_text/content_helper.rb, line 26
def sanitize_action_text_content(content)
  sanitizer.sanitize(
    content.to_html,
    tags: sanitizer_allowed_tags,
    attributes: sanitizer_allowed_attributes,
    scrubber: scrubber,
  ).html_safe
end

sanitize_content_attachment(content_attachment)

# File actiontext/app/helpers/action_text/content_helper.rb, line 17
def sanitize_content_attachment(content_attachment)
  sanitizer.sanitize(
    content_attachment,
    tags: sanitizer_allowed_tags,
    attributes: sanitizer_allowed_attributes,
    scrubber: scrubber,
  )
end

sanitizer_allowed_attributes()

# File actiontext/app/helpers/action_text/content_helper.rb, line 70
def sanitizer_allowed_attributes
  allowed_attributes || (sanitizer.class.allowed_attributes + ActionText::Attachment::ATTRIBUTES)
end

sanitizer_allowed_tags()

# File actiontext/app/helpers/action_text/content_helper.rb, line 66
def sanitizer_allowed_tags
  allowed_tags || (sanitizer.class.allowed_tags + [ ActionText::Attachment.tag_name, "figure", "figcaption" ])
end