mirror of
https://github.com/penpot/penpot.git
synced 2025-08-04 05:38:23 +02:00
🎉 Allow to rename a component in the library
This commit is contained in:
parent
fd1f42dc94
commit
1823ecda40
5 changed files with 104 additions and 23 deletions
|
@ -523,7 +523,8 @@
|
|||
(s/keys :req-un [::id ::name :internal.changes.add-component/shapes]))
|
||||
|
||||
(defmethod change-spec :mod-component [_]
|
||||
(s/keys :req-un [::id ::name :internal.changes.add-component/shapes]))
|
||||
(s/keys :req-un [::id]
|
||||
:opt-un [::name :internal.changes.add-component/shapes]))
|
||||
|
||||
(defmethod change-spec :del-component [_]
|
||||
(s/keys :req-un [::id]))
|
||||
|
@ -964,9 +965,12 @@
|
|||
(defmethod process-change :mod-component
|
||||
[data {:keys [id name shapes]}]
|
||||
(update-in data [:components id]
|
||||
#(assoc %
|
||||
:name name
|
||||
:objects (d/index-by :id shapes))))
|
||||
#(cond-> %
|
||||
(some? name)
|
||||
(assoc :name name)
|
||||
|
||||
(some? shapes)
|
||||
(assoc :objects (d/index-by :id shapes)))))
|
||||
|
||||
(defmethod process-change :del-component
|
||||
[data {:keys [id]}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue