Support null text on paragraphs

I think this was an old feature on medium, but you can see examples of
null text on this post:

https://medium.com/message/the-joy-of-typing-fd8d091ab8ef
This commit is contained in:
Edward Loveall 2021-10-20 20:40:43 -04:00
parent 7166b7d834
commit 5df9c44a5c
No known key found for this signature in database
GPG key ID: 789A4AE983AC8901
2 changed files with 4 additions and 3 deletions

View file

@ -12,11 +12,12 @@ class MarkupConverter
getter markups : Array(PostResponse::Markup) getter markups : Array(PostResponse::Markup)
getter text : String getter text : String
def self.convert(text : String, markups : Array(PostResponse::Markup)) def self.convert(text : String?, markups : Array(PostResponse::Markup))
new(text, markups).convert new(text, markups).convert
end end
def initialize(@text : String, @markups : Array(PostResponse::Markup)) def initialize(text : String?, @markups : Array(PostResponse::Markup))
@text = text || ""
end end
def convert : Array(Child) def convert : Array(Child)

View file

@ -32,7 +32,7 @@ class PostResponse
end end
class Paragraph < Base class Paragraph < Base
property text : String property text : String?
property type : ParagraphType property type : ParagraphType
property markups : Array(Markup) property markups : Array(Markup)
property iframe : IFrame? property iframe : IFrame?