mirror of
https://github.com/penpot/penpot.git
synced 2025-05-26 04:56:14 +02: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)))))
|
(assoc :text (subs text start end)))))
|
||||||
|
|
||||||
(split-texts [text styles]
|
(split-texts [text styles]
|
||||||
(->> (parse-draft-styles styles)
|
(let [children (->> (parse-draft-styles styles)
|
||||||
(build-style-index text)
|
(build-style-index text)
|
||||||
(d/enumerate)
|
(d/enumerate)
|
||||||
(partition-by second)
|
(partition-by second)
|
||||||
(mapv #(build-text text %))))
|
(mapv #(build-text text %)))]
|
||||||
|
(cond-> children
|
||||||
|
(empty? children)
|
||||||
|
(conj {:text ""}))))
|
||||||
|
|
||||||
(build-paragraph [block]
|
(build-paragraph [block]
|
||||||
(let [key (obj/get block "key")
|
(let [key (obj/get block "key")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue