Module: TipTap::JsonRenderable
- Included in:
- Node
- Defined in:
- lib/tip_tap/json_renderable.rb
Instance Method Summary collapse
- #include_empty_content_in_json? ⇒ Boolean
-
#to_h ⇒ Object
Generate a JSON object that is useable by the editor.
Instance Method Details
#include_empty_content_in_json? ⇒ Boolean
7 8 9 |
# File 'lib/tip_tap/json_renderable.rb', line 7 def include_empty_content_in_json? true end |
#to_h ⇒ Object
Generate a JSON object that is useable by the editor
12 13 14 15 16 17 |
# File 'lib/tip_tap/json_renderable.rb', line 12 def to_h json = {type: type_name} json = json.merge(content: content.map(&:to_h)) if should_include_content? json = json.merge(attrs: attrs.deep_symbolize_keys) if attrs.present? json end |