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:
parent
13131a0226
commit
68e3566b8b
1 changed files with 8 additions and 5 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Reference in a new issue