Allow CTRL-Enter to save recipes
This commit is contained in:
parent
5e25ffe296
commit
331f74fa4d
1 changed files with 8 additions and 0 deletions
|
@ -51,6 +51,10 @@
|
||||||
(->> (:chan (dom/listen (sel1 :body) :keyup))
|
(->> (:chan (dom/listen (sel1 :body) :keyup))
|
||||||
(a/filter< #(= (.-keyIdentifier %) "Enter"))))
|
(a/filter< #(= (.-keyIdentifier %) "Enter"))))
|
||||||
|
|
||||||
|
(defn get-ctrl-enters []
|
||||||
|
(->> (:chan (dom/listen (sel1 :body) :keyup))
|
||||||
|
(a/filter< #(and (= (.-keyIdentifier %) "Enter") (.-ctrlKey %)))))
|
||||||
|
|
||||||
(defn get-new-recipe-clicks []
|
(defn get-new-recipe-clicks []
|
||||||
(:chan (dom/listen dom/new-recipe :click)))
|
(:chan (dom/listen dom/new-recipe :click)))
|
||||||
|
|
||||||
|
@ -225,6 +229,9 @@
|
||||||
(transition state :default)
|
(transition state :default)
|
||||||
state))
|
state))
|
||||||
|
|
||||||
|
(defmethod handle-event [:new-recipe :ctrl-enter] [state event]
|
||||||
|
(transition state :default))
|
||||||
|
|
||||||
|
|
||||||
(defmethod enter-state :edit-recipe [old-state new-state-name [elem]]
|
(defmethod enter-state :edit-recipe [old-state new-state-name [elem]]
|
||||||
(dom/-expand! elem)
|
(dom/-expand! elem)
|
||||||
|
@ -280,6 +287,7 @@
|
||||||
:body-click (get-body-clicks)
|
:body-click (get-body-clicks)
|
||||||
:edit (chan)
|
:edit (chan)
|
||||||
:enter (get-enters)
|
:enter (get-enters)
|
||||||
|
:ctrl-enter (get-ctrl-enters)
|
||||||
:new-recipe-click (get-new-recipe-clicks)
|
:new-recipe-click (get-new-recipe-clicks)
|
||||||
:edit-recipe-click (get-edit-recipe-clicks)
|
:edit-recipe-click (get-edit-recipe-clicks)
|
||||||
:recipe-done-btn-click (get-recipe-done-btn-clicks)})
|
:recipe-done-btn-click (get-recipe-done-btn-clicks)})
|
||||||
|
|
Loading…
Reference in a new issue