0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 00:40:30 -05:00

🐛 Fix whitespace handling on color assets name

This commit is contained in:
Andrey Antukh 2023-07-06 10:53:31 +02:00
parent c16de52b49
commit 88ac27788b

View file

@ -147,18 +147,20 @@
(defn rename-color (defn rename-color
[file-id id new-name] [file-id id new-name]
(dm/assert! (uuid? file-id)) (dm/verify! (uuid? file-id))
(dm/assert! (uuid? id)) (dm/verify! (uuid? id))
(dm/assert! (string? new-name)) (dm/verify! (string? new-name))
(ptk/reify ::rename-color (ptk/reify ::rename-color
ptk/WatchEvent ptk/WatchEvent
(watch [it state _] (watch [it state _]
(when (and (some? new-name) (not= "" new-name)) (let [new-name (str/trim new-name)]
(let [data (get state :workspace-data) (if (str/empty? new-name)
object (get-in data [:colors id]) (rx/empty)
new-object (assoc object :name new-name)] (let [data (get state :workspace-data)
(do-update-color it state new-object file-id)))))) object (get-in data [:colors id])
object (assoc object :name new-name)]
(do-update-color it state object file-id)))))))
(defn delete-color (defn delete-color
[{:keys [id] :as params}] [{:keys [id] :as params}]