                        "reabledit-cell-editor-dropdown-list__item--selected")
               :on-click (fn [e]
                           (.stopPropagation e)
-                          (change-fn key)
+                          (change-edited! key)
                           (disable-edit!))}
              [:span.reabledit-cell__content value]])]]))}))
 

;;

(defn default-editor
  [_ edited-row-data k change-fn _]
  [:input.reabledit-cell-editor-input
   {:type "text"
    :auto-focus true
    :on-focus util/move-cursor-to-end!
    :value (get edited-row-data k)
    :on-change #(change-fn (assoc edited-row-data
                                  k
                                  (-> % .-target .-value)))}])

(defn int-editor
  [initial-row-data edited-row-data k change-fn _]
  (let [initial-value (get initial-row-data k)
        input-candidate (str (get edited-row-data k))
        input (reagent/atom input-candidate)]
    (change-fn (assoc edited-row-data
                      k
                      (util/parse-int input-candidate initial-value)))
    (fn [initial-row-data edited-row-data k change-fn _]
      [:input.reabledit-cell-editor-input
       {:type "text"
        :class (if-not (util/int-coercable? @input)

      38 (do
           (.preventDefault e)
           (if (zero? position)
             (change-edited! (-> options last :key))
             (change-edited! (:key (nth options (dec position))))))
      40 (do
           (.preventDefault e)
           (if (= position (-> options count dec))
             (change-edited! (-> options first :key))
             (change-edited! (:key (nth options (inc position))))))
      nil)))

(defn dropdown-editor
  [_ edited-row-data k change-edited! disable-edit! {:keys [options]}]
  (reagent/create-class
   {:component-did-mount #(.focus (reagent/dom-node %))
    :reagent-render
    (fn [_ edited-row-data k change-edited! disable-edit! {:keys [options]}]
      (let [v (get edited-row-data k)
            change-edited! #(change-edited! (assoc edited-row-data k %))]
        [:div.reabledit-cell-editor-dropdown
         {:tabIndex 0
          :on-key-down #(dropdown-editor-key-down % v change-edited! options)}
         [:span.reabledit-cell__content
          (-> (filter #(= (:key %) v) options)
              first
