       (dom/div #js {:id "title-field"}
         (dom/input #js {:type "text"
                         :onChange #(handle-title-change % app)
+                        :onBlur #(handle-title-blur % app)
                         :value (:title app)})))))
 
 ;; Left menu

(defn update-current [event app]
  (let [title (.. event -target -textContent)]
    (om/update! app :input (p/get-document title))
    (om/update! app :title title)))

(defn delete-click [title app]
  (p/remove-document title)


(defn save-document [app]
  (om/update! app :last-saved (js/Date.))
  (om/update! app :last-title (:title @app))
  (p/set-document (:title @app) (:input @app))
  (om/update! app :titles (p/get-all-titles)))

