0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

Use keydown instead of keyup for title edition on image collections.

This commit is contained in:
Andrey Antukh 2016-05-24 00:07:11 +03:00
parent 80941da252
commit 38eb985c48
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -85,10 +85,16 @@
(swap! local assoc :edit false))
(on-title-edited [e]
(cond
(kbd/esc? e) (swap! local assoc :edit false)
(kbd/enter? e) (on-title-save e)
:else (let [content (dom/event->inner-text e)]
(swap! local assoc :coll-name content))))
(kbd/esc? e)
(swap! local assoc :edit false)
(kbd/enter? e)
(do (dom/stop-propagation e)
(on-title-save e))
:else
(let [content (dom/event->inner-text e)]
(swap! local assoc :coll-name content))))
(on-title-edit [e]
(swap! local assoc :edit true :coll-name (:name coll)))
(on-delete [e]
@ -100,7 +106,7 @@
[:div.dashboard-title-field
[:span.edit
{:content-editable ""
:on-key-up on-title-edited}
:on-key-down on-title-edited}
(:name coll)]
[:span.close
{:on-click #(swap! local assoc :edit false)}