mirror of
https://github.com/penpot/penpot.git
synced 2026-07-28 17:06:21 +00:00
🐛 Fix property input remains editable after keeping default property name (#7549)
* 🐛 Fix property input remains focused when keeping default property name * 📎 PR changes
This commit is contained in:
parent
5e6af5aea9
commit
e073b89604
@ -28,11 +28,7 @@
|
||||
(pcb/update-component
|
||||
changes (:id component)
|
||||
(fn [component]
|
||||
(d/update-in-when component [:variant-properties pos]
|
||||
(fn [property]
|
||||
(-> property
|
||||
(assoc :name new-name)
|
||||
(with-meta nil)))))
|
||||
(d/update-in-when component [:variant-properties pos] #(assoc % :name new-name)))
|
||||
{:apply-changes-local-library? true}))
|
||||
changes
|
||||
related-components)))
|
||||
|
||||
@ -99,9 +99,25 @@
|
||||
|
||||
(defn update-property-name
|
||||
"Update the variant property name on the position pos
|
||||
in all the components with this variant-id"
|
||||
in all the components with this variant-id and remove the focus"
|
||||
[variant-id pos new-name {:keys [trigger]}]
|
||||
(ptk/reify ::update-property-name
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(let [file-id (:current-file-id state)
|
||||
data (dsh/lookup-file-data state)
|
||||
objects (dsh/lookup-page-objects state)
|
||||
|
||||
related-components (cfv/find-variant-components data objects variant-id)]
|
||||
|
||||
(reduce
|
||||
(fn [s related-component]
|
||||
(update-in s
|
||||
[:files file-id :data :components (:id related-component) :variant-properties]
|
||||
(fn [props] (mapv #(with-meta % nil) props))))
|
||||
state
|
||||
related-components)))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(let [page-id (:current-page-id state)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user