           :grid (p (dom/span #js {:onClick #(transition {:state :init})}
                              (str "{- " (:width state) " (" (:bpc state) ") ... "))
                    (dom/input #js {:type "text" :value (:text state)
-                                   :onChange #(handle-change % owner state)})
+                                   :onChange #(handle-change % owner state :text)})
                    (dom/span #js {:onClick commit} " commit? ")
                    (dom/span nil "}"))
           :commit (p (dom/span #js {:onClick #(transition {:state :init})}

        (condp = (:state state)
          :init (dom/table nil
                           (apply dom/tbody nil
                                  (map (fn [k v] (dom/tr nil
                                                         (dom/td nil k)
                                                         (dom/td #js {:onClick #(om/update-state! owner
                                                                                                  (fn [s] (merge s {:state :editing
                                                                                                                    :text v
                                                                                                                    :field k})))}
                                                                 v)))
                                       (keys cursor)
                                       (vals cursor))))
          :editing (dom/table nil
                              (apply dom/tbody nil
                                     (map (fn [k v] (dom/tr nil
                                                            (dom/td nil k)
                                                            (if (= k (:field state))
                                                              (dom/td nil
                                                                      (dom/input #js {:type "text" :value (:text state)
                                                                                      :onChange #(handle-change % owner state)
                                                                                      :onKeyDown #(when (= 13 (.-which %))
                                                                                                    (commit))}))
                                                              (dom/td #js {:onClick #(om/update-state! owner
                                                                                                       (fn [s] (merge s {:state :editing
                                                                                                                         :text v
                                                                                                                         :field k})))}
                                                                      v))))
                                          (keys cursor)
                                          (vals cursor)))))))))
                         

(defn track-editor [{:keys [cursor id delete-ch set-state-ch]} owner]

(defn samples []
  (om/ref-cursor (:samples (om/root-cursor app-state))))

(defn handle-change [e owner state key]
  (om/set-state! owner key (.. e -target -value)))

(defn cell-view [{:keys [cursor id]} _]
  (reify
