 (defn ace-editor [value pos ext name]
   (-> (io {:input (chan) ; this channel is to pipe information to the js-script (optional to prevent rerendering)
            :output (chan) ; this channel is collected by morphic to generate :io signals (mandatory)
-           :state (atom {:edited-value value})
+           :init-value value
            :extent ext
            :position pos
            :id name

                                        :style  {:height (-> props :extent :y) :width (-> props :extent :x)} 
                                        :className "ace"})))
           :init (fn [props dom-node]
                   (let [local-state (props :state)
                         ace-instance (.edit js/ace (props :id))
                         clojure-mode (-> js/ace
                                        (.require "ace/mode/clojure")
                                        .-Mode)]

                        (addCommand  (clj->js {:name "save"
                                                :bindKey {:win "Ctrl-S" :mac "Ctrl-S" :sender "editor|cli"}
                                                :exec #(save-handler ace-instance (props :output))})))
                     (set-value! ace-instance (:init-value props))
                     (go-loop []
                       (let [new-value (<! (props :input))]
                         (set-value! ace-instance new-value))
                       (recur))))})))