   (if (= 13 (.-keyCode e))
     (do
       (.preventDefault e)
-      (swap! state dissoc :edit-mode)
+      (swap! state dissoc :edit)
       ;; Dirty as fudge, but what can you do with Reagent?
       (.focus (.getElementById js/document id)))
     nil))

      39 (f current-row (min cols (inc current-col)))
      40 (f (min rows (inc current-row)) current-col)
      9 (f current-row (min cols (inc current-col)))
      13 (enable-edit-mode! state current-row current-col)
      nil)))

(defn handle-key-down
  [e headers data state id]
  (if (:edit-mode @state)
    (handle-editing-mode-key-down e state id)
    (handle-selection-mode-key-down e headers data state)))


(defn data-table-cell
  [v nth-row nth-col state]
  (let [selected? (= (:selected @state) [nth-row nth-col])
        edit? (:edit @state)]
    [:td {:class (if selected? "selected")
          :on-click #(set-selected! state nth-row nth-col)}
     (if (and selected? edit?)
       [:input {:type "text"
                :auto-focus true
                :value v}]
