mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 06:02:32 -05:00
Fix editing/saving
This commit is contained in:
parent
169d71b2df
commit
6ed5dc138d
2 changed files with 9 additions and 17 deletions
|
@ -24,11 +24,8 @@
|
|||
|
||||
(mf/defc labeled-input
|
||||
{::mf/wrap-props false}
|
||||
[{:keys [input-ref label default-value on-change auto-focus? auto-complete?]}]
|
||||
(let [input-props (cond-> {:ref input-ref
|
||||
:default-value default-value
|
||||
:autoFocus auto-focus?
|
||||
:on-change on-change}
|
||||
[{:keys [label input-props auto-complete?]}]
|
||||
(let [input-props (cond-> input-props
|
||||
;; Disable auto-complete on form fields for proprietary password managers
|
||||
;; https://github.com/orgs/tokens-studio/projects/69/views/11?pane=issue&itemId=63724204
|
||||
(not auto-complete?) (assoc :data-1p-ignore true
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
|
||||
name (mf/use-var (or (:name token) ""))
|
||||
on-update-name #(reset! name (dom/get-target-val %))
|
||||
name-ref (mf/use-ref)
|
||||
|
||||
token-value (mf/use-var (or (:value token) ""))
|
||||
|
||||
|
@ -79,29 +78,25 @@
|
|||
(st/emit! (dt/add-token token))
|
||||
(modal/hide!)))]
|
||||
|
||||
(mf/use-effect
|
||||
(fn []
|
||||
(dom/focus! (mf/ref-val name-ref))))
|
||||
|
||||
[:form
|
||||
{:class (stl/css :shadow)
|
||||
:style (clj->js style)
|
||||
:on-submit on-submit}
|
||||
[:div {:class (stl/css :token-rows)}
|
||||
[:& tokens.common/labeled-input {:label "Name"
|
||||
:default-value @name
|
||||
:on-change on-update-name
|
||||
:input-ref name-ref}]
|
||||
:input-props {:defaultValue @name
|
||||
:autoFocus true
|
||||
:onChange on-update-name}}]
|
||||
(for [[idx {:keys [type label]}] (d/enumerate @state)]
|
||||
[:* {:key (str "form-field-" idx)}
|
||||
(case type
|
||||
:box-shadow [:p "TODO BOX SHADOW"]
|
||||
[:& tokens.common/labeled-input {:label label
|
||||
:default-value @token-value
|
||||
:on-change #(on-update-state-field idx %)}])])
|
||||
:input-props {:defaultValue @token-value
|
||||
:onChange #(on-update-state-field idx %)}}])])
|
||||
[:& tokens.common/labeled-input {:label "Description"
|
||||
:default-value @description
|
||||
:on-change #(on-update-description %)}]
|
||||
:input-props {:defaultValue @description
|
||||
:onChange #(on-update-description %)}}]
|
||||
[:div {:class (stl/css :button-row)}
|
||||
[:button {:class (stl/css :button)
|
||||
:type "submit"}
|
||||
|
|
Loading…
Add table
Reference in a new issue