Class: RicherText::JsonText
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- RicherText::JsonText
- Defined in:
- app/models/richer_text/json_text.rb
Constant Summary collapse
- DEFAULT_BODY =
{"type" => "doc", "content" => [{"type" => "paragraph", "attrs" => {"textAlign" => "left"}}]}
Instance Method Summary collapse
Instance Method Details
#mentionees ⇒ Object
26 27 28 29 30 |
# File 'app/models/richer_text/json_text.rb', line 26 def mentionees gids = mention_nodes.map(&:id).compact_blank GlobalID::Locator.locate_many(gids).uniq # Only return unique records end |
#to_editor_format ⇒ Object
14 15 16 |
# File 'app/models/richer_text/json_text.rb', line 14 def to_editor_format body end |
#to_plain_text ⇒ Object
22 23 24 |
# File 'app/models/richer_text/json_text.rb', line 22 def to_plain_text RicherText.default_text_renderer.visit(document) end |
#to_s ⇒ Object
18 19 20 |
# File 'app/models/richer_text/json_text.rb', line 18 def to_s RicherText.default_renderer.visit(document) end |