🐛 Add missing styles to the empty node on editor-v1

This commit is contained in:
Andrey Antukh 2025-07-30 11:45:39 +02:00
parent e1c5a32fcb
commit 7fde1436e1

View File

@ -292,7 +292,7 @@
(fix-gradients) (fix-gradients)
(assoc :text text)))) (assoc :text text))))
(split-texts [text styles] (split-texts [text styles data]
(let [cpoints (text->code-points text) (let [cpoints (text->code-points text)
children (->> (parse-draft-styles styles) children (->> (parse-draft-styles styles)
(build-style-index (count cpoints)) (build-style-index (count cpoints))
@ -301,7 +301,7 @@
(mapv #(extract-text cpoints %)))] (mapv #(extract-text cpoints %)))]
(cond-> children (cond-> children
(empty? children) (empty? children)
(conj {:text ""})))) (conj (assoc data :text "")))))
(build-paragraph [block] (build-paragraph [block]
(let [key (get block :key) (let [key (get block :key)
@ -312,7 +312,7 @@
(-> data (-> data
(assoc :key key) (assoc :key key)
(assoc :type "paragraph") (assoc :type "paragraph")
(assoc :children (split-texts text styles)))))] (assoc :children (split-texts text styles data)))))]
{:type "root" {:type "root"
:children :children