mirror of
https://github.com/penpot/penpot.git
synced 2025-05-18 23:46:11 +02:00
🐛 Fix enter key on team modal
This commit is contained in:
parent
9898ad1991
commit
c0a2550485
2 changed files with 14 additions and 2 deletions
|
@ -87,7 +87,7 @@
|
||||||
(swap! form assoc-in [:touched input-name] true)))
|
(swap! form assoc-in [:touched input-name] true)))
|
||||||
|
|
||||||
props (-> props
|
props (-> props
|
||||||
(dissoc :help-icon :form :trim :children :show-success?)
|
(dissoc :help-icon :form :trim :children :show-success? :auto-focus?)
|
||||||
(assoc :id (name input-name)
|
(assoc :id (name input-name)
|
||||||
:value value
|
:value value
|
||||||
:auto-focus auto-focus?
|
:auto-focus auto-focus?
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.forms :as fm]
|
[app.main.ui.components.forms :as fm]
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
|
[app.util.dom :as dom]
|
||||||
[app.util.i18n :as i18n :refer [tr]]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
|
[app.util.keyboard :as kbd]
|
||||||
[app.util.router :as rt]
|
[app.util.router :as rt]
|
||||||
[beicon.v2.core :as rx]
|
[beicon.v2.core :as rx]
|
||||||
[cljs.spec.alpha :as s]
|
[cljs.spec.alpha :as s]
|
||||||
|
@ -74,6 +76,15 @@
|
||||||
:validators [(fm/validate-not-empty :name (tr "auth.name.not-all-space"))
|
:validators [(fm/validate-not-empty :name (tr "auth.name.not-all-space"))
|
||||||
(fm/validate-length :name fm/max-length-allowed (tr "auth.name.too-long"))]
|
(fm/validate-length :name fm/max-length-allowed (tr "auth.name.too-long"))]
|
||||||
:initial initial)
|
:initial initial)
|
||||||
|
handle-keydown
|
||||||
|
(mf/use-callback
|
||||||
|
(mf/deps)
|
||||||
|
(fn [e]
|
||||||
|
(when (kbd/enter? e)
|
||||||
|
(dom/prevent-default e)
|
||||||
|
(dom/stop-propagation e)
|
||||||
|
(on-submit form e))))
|
||||||
|
|
||||||
on-close #(st/emit! (modal/hide))]
|
on-close #(st/emit! (modal/hide))]
|
||||||
|
|
||||||
[:div {:class (stl/css :modal-overlay)}
|
[:div {:class (stl/css :modal-overlay)}
|
||||||
|
@ -97,7 +108,8 @@
|
||||||
:form form
|
:form form
|
||||||
:name :name
|
:name :name
|
||||||
:placeholder "E.g. Design"
|
:placeholder "E.g. Design"
|
||||||
:label (tr "labels.create-team.placeholder")}]]
|
:label (tr "labels.create-team.placeholder")
|
||||||
|
:on-key-down handle-keydown}]]
|
||||||
|
|
||||||
[:div {:class (stl/css :modal-footer)}
|
[:div {:class (stl/css :modal-footer)}
|
||||||
[:div {:class (stl/css :action-buttons)}
|
[:div {:class (stl/css :action-buttons)}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue