0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-15 17:21:17 -05:00

🐛 Fix problem when changing track data in editor

This commit is contained in:
alonso.torres 2024-03-04 14:57:24 +01:00 committed by Andrey Antukh
parent bcd859ca4c
commit f36410da87

View file

@ -736,20 +736,23 @@
[track-type value] [track-type value]
(cond (cond
(str/ends-with? value "%") (str/ends-with? value "%")
[:percent value-int] [:percent (d/nilv value-int 50)]
(str/ends-with? value "FR") (str/ends-with? value "FR")
[:flex value-int] [:flex (d/nilv value-int 1)]
(some? value-int) (some? value-int)
[:fixed value-int] [:fixed (d/nilv value-int 100)]
(or (= value "AUTO") (= "" value)) :else
[:auto nil])] [:auto nil])
track-data (when (some? track-type) {:type track-type :value value})]
(dom/set-value! (mf/ref-val track-input-ref) (format-size track-data))
(if (some? track-type) (if (some? track-type)
(do (st/emit! (dwsl/change-layout-track [(:id shape)] type index {:type track-type :value value})) (do (st/emit! (dwsl/change-layout-track [(:id shape)] type index track-data))
(dom/set-data! target "default-value" (format-size {:type track-type :value value}))) (dom/set-data! target "default-value" (format-size track-data)))
(obj/set! target "value" (dom/get-attribute target "data-default-value")))))) (obj/set! target "value" (dom/get-attribute target "data-default-value"))))))
handle-keydown-track-input handle-keydown-track-input