From 68e3566b8b10cf8dbc4155a8e5bef86ccb3ff951 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 15 Mar 2021 17:17:01 +0100 Subject: [PATCH] :bug: Properly handle empty blocks on draft-js format conversion. --- frontend/src/app/util/text_editor.cljs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/util/text_editor.cljs b/frontend/src/app/util/text_editor.cljs index 88e8e5253..4eabbf4ef 100644 --- a/frontend/src/app/util/text_editor.cljs +++ b/frontend/src/app/util/text_editor.cljs @@ -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")