Module: Spina::Embeds::TrixConversion

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/spina/embeds/trix_conversion.rb

Instance Method Summary collapse

Instance Method Details

#to_trix_attachment(content = trix_attachment_content) ⇒ Object

Wrap rendered partial in an <embed> tag for Trix



7
8
9
# File 'lib/spina/embeds/trix_conversion.rb', line 7

def to_trix_attachment(content = trix_attachment_content)
  wrap_with_embed_tag(content)
end

#wrap_with_embed_tag(html) ⇒ Object



11
12
13
14
15
# File 'lib/spina/embeds/trix_conversion.rb', line 11

def wrap_with_embed_tag(html)
  element = html_document.create_element("spina-embed", embed_tag_attributes)
  element.inner_html = html
  element.to_html
end