mirror of
https://github.com/penpot/penpot.git
synced 2026-03-21 18:03:47 +00:00
🐛 Fix focus new added property (#7065)
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
|
||||
(mf/defc input-with-meta*
|
||||
{::mf/schema schema:input-with-meta}
|
||||
[{:keys [value meta max-length on-blur] :rest props}]
|
||||
(let [editing* (mf/use-state false)
|
||||
[{:keys [value meta max-length is-editing on-blur] :rest props}]
|
||||
(let [editing* (mf/use-state (d/nilv is-editing false))
|
||||
editing? (deref editing*)
|
||||
|
||||
input-ref (mf/use-ref)
|
||||
|
||||
@@ -443,7 +443,8 @@
|
||||
(st/emit! (dwv/transform-in-variant id))))
|
||||
|
||||
do-add-new-property
|
||||
#(st/emit! (dwv/add-new-property variant-id {:property-value "Value 1"}))
|
||||
#(st/emit! (dwv/add-new-property variant-id {:property-value "Value 1"
|
||||
:editing? true}))
|
||||
|
||||
do-show-local-component
|
||||
#(st/emit! (dwl/go-to-local-component :id component-id))
|
||||
|
||||
@@ -359,6 +359,7 @@
|
||||
[:*
|
||||
[:div {:class (stl/css :variant-property-name-wrapper)}
|
||||
[:> input-with-meta* {:value (:name prop)
|
||||
:is-editing (:editing? (meta prop))
|
||||
:max-length ctv/property-max-length
|
||||
:data-position pos
|
||||
:on-blur update-property-name}]]
|
||||
@@ -995,7 +996,8 @@
|
||||
menu-open? (deref menu-open*)
|
||||
|
||||
menu-entries [{:title (tr "workspace.shape.menu.add-variant-property")
|
||||
:action #(st/emit! (dwv/add-new-property variant-id {:property-value "Value 1"}))}
|
||||
:action #(st/emit! (dwv/add-new-property variant-id {:property-value "Value 1"
|
||||
:editing? true}))}
|
||||
{:title (tr "workspace.shape.menu.add-variant")
|
||||
:action #(st/emit! (dwv/add-new-variant (:id shape)))}]
|
||||
|
||||
@@ -1101,14 +1103,16 @@
|
||||
[:div {:class (stl/css :variant-property-list)}
|
||||
(for [[pos property] (map-indexed vector properties)]
|
||||
(let [last-prop? (<= (count properties) 1)
|
||||
meta (->> (:value property)
|
||||
values (->> (:value property)
|
||||
(move-empty-items-to-end)
|
||||
(replace {"" "--"})
|
||||
(str/join ", "))]
|
||||
(str/join ", "))
|
||||
is-editing (:editing? (meta property))]
|
||||
[:div {:key (str (:id shape) pos)
|
||||
:class (stl/css :variant-property-row)}
|
||||
[:> input-with-meta* {:value (:name property)
|
||||
:meta meta
|
||||
:meta values
|
||||
:is-editing is-editing
|
||||
:max-length ctv/property-max-length
|
||||
:data-position pos
|
||||
:on-blur update-property-name}]
|
||||
|
||||
Reference in New Issue
Block a user