(defn
refresh-content!
"Refreshes the content."
[content state]
(if-let
[crop (:cropped-state state)]
(let
[crop (refresh-content-element! crop)]
(if
(not= (:text state) (.-textContent content))
(refresh-content! content (dissoc state :cropped-state))
(assoc state :cropped-state crop)))
(do
(set! (.-innerHTML content) (hs/code->html (:text state)))
(dissoc state :cropped-state))))