mirror of
https://github.com/penpot/penpot.git
synced 2025-08-01 17:18:26 +02:00
🐛 Fix variant switch in another page (#6802)
This commit is contained in:
parent
804146ae9a
commit
20b5b7f6e4
2 changed files with 12 additions and 2 deletions
|
@ -91,11 +91,14 @@
|
||||||
;; shape on the main component
|
;; shape on the main component
|
||||||
orig-ref-shape (ctf/find-ref-shape nil container libraries original-shape)
|
orig-ref-shape (ctf/find-ref-shape nil container libraries original-shape)
|
||||||
|
|
||||||
|
orig-ref-objects (-> (ctf/get-component-container-from-head orig-ref-shape libraries)
|
||||||
|
:objects)
|
||||||
|
|
||||||
;; Adds a :shape-path attribute to the children of the orig-ref-shape,
|
;; Adds a :shape-path attribute to the children of the orig-ref-shape,
|
||||||
;; that contains the type of its ancestors and its name
|
;; that contains the type of its ancestors and its name
|
||||||
o-ref-shapes-wp (add-unique-path
|
o-ref-shapes-wp (add-unique-path
|
||||||
(reverse (cfh/get-children-with-self objects (:id orig-ref-shape)))
|
(reverse (cfh/get-children-with-self orig-ref-objects (:id orig-ref-shape)))
|
||||||
objects
|
orig-ref-objects
|
||||||
(:id orig-ref-shape))
|
(:id orig-ref-shape))
|
||||||
|
|
||||||
;; Creates a map to quickly find a child of the orig-ref-shape by its shape-path
|
;; Creates a map to quickly find a child of the orig-ref-shape by its shape-path
|
||||||
|
|
|
@ -242,6 +242,13 @@
|
||||||
(cfh/make-container component-page :page))
|
(cfh/make-container component-page :page))
|
||||||
(cfh/make-container component :component)))
|
(cfh/make-container component :component)))
|
||||||
|
|
||||||
|
(defn get-component-container-from-head
|
||||||
|
[instance-head libraries & {:keys [include-deleted?] :or {include-deleted? true}}]
|
||||||
|
(let [library-data (-> (get-component-library libraries instance-head)
|
||||||
|
:data)
|
||||||
|
component (ctkl/get-component library-data (:component-id instance-head) include-deleted?)]
|
||||||
|
(get-component-container library-data component)))
|
||||||
|
|
||||||
(defn get-component-root
|
(defn get-component-root
|
||||||
"Retrieve the root shape of the component."
|
"Retrieve the root shape of the component."
|
||||||
[file-data component]
|
[file-data component]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue