                          :className "new-environment"}
                     "New Environment")))))
 
-(defn handle-change [e data edit-key owner]
+(defn handle-change [e data edit-key]
   (om/transact! data edit-key (fn [_] (.. e -target -value))))
 
 (defn end-edit [text owner cb]

                (dom/textarea
                 #js {:className "edit-content-input"
                      :style (display editing)
                      :value text
                      :ref "input"
                      :onChange #(handle-change % data edit-key owner)
                      :onKeyDown #(case (.-keyCode %)
                                    13 (end-edit text owner on-edit)
                                    nil)
                      :onBlur (fn [e]
                                (when (om/get-state owner :editing)
                                  (end-edit text owner on-edit)))}))))))

(defn note-view [app owner]
  (reify

  (reify
    om/IInitState
    (init-state [_]
      {:editing false
       :edit-text (get data edit-key)})
    om/IDidUpdate
    (did-update [this prev-props prev-state]
      (when (and (om/get-state owner :editing)
                 (not (:editing prev-state)))
        (focus-and-set-cursor (om/get-node owner "input"))))
    om/IRenderState
    (render-state [this {:keys [editing edit-text]}]
      (let [text (get data edit-key)
            reset #(om/set-state! owner {:editing false
                                         :edit-text text})]
        (dom/div #js {:className "note-content"}
                (dom/p #js {:style (display (not editing))
                            :onClick (fn [el] (om/set-state! owner :editing true))}
