From f36410da87294b68a15a0d6ad76ebf1f2910b718 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 4 Mar 2024 14:57:24 +0100 Subject: [PATCH] :bug: Fix problem when changing track data in editor --- .../workspace/viewport/grid_layout_editor.cljs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/viewport/grid_layout_editor.cljs b/frontend/src/app/main/ui/workspace/viewport/grid_layout_editor.cljs index 745631167..4621560a7 100644 --- a/frontend/src/app/main/ui/workspace/viewport/grid_layout_editor.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/grid_layout_editor.cljs @@ -736,20 +736,23 @@ [track-type value] (cond (str/ends-with? value "%") - [:percent value-int] + [:percent (d/nilv value-int 50)] (str/ends-with? value "FR") - [:flex value-int] + [:flex (d/nilv value-int 1)] (some? value-int) - [:fixed value-int] + [:fixed (d/nilv value-int 100)] - (or (= value "AUTO") (= "" value)) - [:auto nil])] + :else + [: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) - (do (st/emit! (dwsl/change-layout-track [(:id shape)] type index {:type track-type :value value})) - (dom/set-data! target "default-value" (format-size {: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 track-data))) (obj/set! target "value" (dom/get-attribute target "data-default-value")))))) handle-keydown-track-input