0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

🐛 Properly handle empty blocks on draft-js format conversion.

This commit is contained in:
Andrey Antukh 2021-03-15 17:17:01 +01:00
parent 13131a0226
commit 68e3566b8b

View file

@ -105,11 +105,14 @@
(assoc :text (subs text start end)))))
(split-texts [text styles]
(->> (parse-draft-styles styles)
(build-style-index text)
(d/enumerate)
(partition-by second)
(mapv #(build-text text %))))
(let [children (->> (parse-draft-styles styles)
(build-style-index text)
(d/enumerate)
(partition-by second)
(mapv #(build-text text %)))]
(cond-> children
(empty? children)
(conj {:text ""}))))
(build-paragraph [block]
(let [key (obj/get block "key")