mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 03:56:11 +02:00
🐛 Fix restore totally deleted variant should add props as name
This commit is contained in:
parent
e271caa32b
commit
6b300d516b
2 changed files with 5 additions and 15 deletions
|
@ -450,12 +450,12 @@
|
||||||
changes
|
changes
|
||||||
(rest moved-shapes))
|
(rest moved-shapes))
|
||||||
changes (cond-> changes
|
changes (cond-> changes
|
||||||
;; Transform variant info into name when restoring into a parent that is not a variant-container
|
;; Transform variant info into name when restoring into a parent that is not a variant-container,
|
||||||
(and is-variant? parent (not (ctk/is-variant-container? parent)))
|
;; or when restoring into a variant-container that doesn't exists anymore
|
||||||
|
(and is-variant?
|
||||||
|
(or (and parent (not (ctk/is-variant-container? parent)))
|
||||||
|
(nil? restoring-into-parent)))
|
||||||
(clvp/generate-make-shapes-no-variant [first-shape])
|
(clvp/generate-make-shapes-no-variant [first-shape])
|
||||||
;; Remove variant info when restoring into a variant-container that doesn't exists anymore
|
|
||||||
(and is-variant? (nil? restoring-into-parent))
|
|
||||||
(clvp/generate-delete-variant-info first-shape)
|
|
||||||
;; Add variant info and rename when restoring into a variant-container
|
;; Add variant info and rename when restoring into a variant-container
|
||||||
(ctk/is-variant-container? restoring-into-parent)
|
(ctk/is-variant-container? restoring-into-parent)
|
||||||
(clvp/generate-make-shapes-variant [first-shape] restoring-into-parent))]
|
(clvp/generate-make-shapes-variant [first-shape] restoring-into-parent))]
|
||||||
|
|
|
@ -93,16 +93,6 @@
|
||||||
related-components)]
|
related-components)]
|
||||||
changes))
|
changes))
|
||||||
|
|
||||||
|
|
||||||
(defn generate-delete-variant-info
|
|
||||||
[changes shape]
|
|
||||||
(-> changes
|
|
||||||
(pcb/update-component (:component-id shape)
|
|
||||||
#(dissoc % :variant-id :variant-properties)
|
|
||||||
{:apply-changes-local-library? true})
|
|
||||||
(pcb/update-shapes [(:id shape)]
|
|
||||||
#(dissoc % :variant-id :variant-name))))
|
|
||||||
|
|
||||||
(defn- generate-make-shape-no-variant
|
(defn- generate-make-shape-no-variant
|
||||||
[changes shape]
|
[changes shape]
|
||||||
(let [new-name (ctv/variant-name-to-name shape)
|
(let [new-name (ctv/variant-name-to-name shape)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue