instance method to_editor_html

Ruby on Rails edge

Since edge

Signature

to_editor_html()

Returns the body attribute in a format that makes it editable in the editor. Previews of attachments are rendered inline.

content = "<h1>Funny Times!</h1><figure data-action-text-attachment='{\"sgid\":\"..."\}'></figure>"
message = Message.create!(content: content)
message.content.to_editor_html # =>
# <div class="trix-content">
#   <h1>Funny times!</h1>
#   <figure data-action-text-attachment='{\"sgid\":\"..."\}'>
#      <img src="http://example.org/rails/active_storage/.../funny.jpg">
#   </figure>
# </div>
Source
# File actiontext/app/models/action_text/rich_text.rb, line 126
    def to_editor_html
      body&.to_editor_html
    end

Defined in actiontext/app/models/action_text/rich_text.rb line 126 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionText::RichText

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close