Skip to content

Commit

Permalink
Always include text while using to_h (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwilken authored Jul 18, 2024
1 parent 04c6aa0 commit b102d70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/tip_tap/nodes/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def self.from_json(json)
end

def to_h
{type: type_name, text: text, marks: marks.map(&:deep_symbolize_keys)}.compact_blank
data = {type: type_name, text: text.presence || ""}
data[:marks] = marks.map(&:deep_symbolize_keys) unless marks.empty?
data
end

def to_html
Expand Down

0 comments on commit b102d70

Please sign in to comment.