0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Add function to verify already used names

This commit is contained in:
Florian Schroedl 2024-06-19 13:54:09 +02:00
parent deb9cb1120
commit 1596dbe155

View file

@ -80,6 +80,12 @@
{::mf/wrap-props false}
[{:keys [token-type x y position fields token] :as args}]
(let [tokens (sd/use-resolved-workspace-tokens {:debug? true})
used-token-names (mf/use-memo
(mf/deps tokens)
(fn []
(-> (into #{} (map (fn [[_ {:keys [name]}]] name) tokens))
;; Allow setting token to already used name
(disj (:name token)))))
vport (mf/deref viewport)
style (calculate-position vport position x y)