              (let [content (js->clj val :keywordize-keys true)
                    content (first content)]
                (st/emit! (dw/update-shape id {:content content}))
-               (reset! state val)))))
+               (reset! state val)
+               (reset! content-var content)))))
 
         loaded-fonts (mf/use-var 0)
         on-load-font #(swap! loaded-fonts inc)]

        (fn [event]
          (dom/prevent-default event)
          (dom/stop-propagation event)
          (let [sidebar (dom/get-element "settings-bar")
                cpicker (dom/get-element-by-class "colorpicker-tooltip")
                self    (mf/ref-val self-ref)

    (map? content) (clj->js [content])
    :else (initial-text "")))

(defn- content-size
  [node]
  (let [current (count (:text node))
        children-count (->> node :children (map content-size) (reduce +))]
    (+ current children-count)))

(mf/defc text-shape-edit
  {::mf/wrap [mf/memo]}
  [{:keys [shape read-only?] :or {read-only? false} :as props}]
