mirror of
https://github.com/penpot/penpot.git
synced 2025-03-28 15:41:25 -05:00
🐛 Fix problem with duplicate in main component
This commit is contained in:
parent
3bbf97fde9
commit
786513863b
2 changed files with 12 additions and 2 deletions
|
@ -240,3 +240,13 @@
|
|||
(distinct)
|
||||
(filter #(not (eq % (get comp1 %) (get comp2 %))))
|
||||
set)))
|
||||
|
||||
(defn allow-duplicate?
|
||||
[objects shape]
|
||||
|
||||
(let [parent (get objects (:parent-id shape))]
|
||||
;; We don't want to change the structure of component copies
|
||||
(and (not (in-component-copy-not-head? shape))
|
||||
;; Non instance, non copy. We allow
|
||||
(or (not (instance-head? shape))
|
||||
(not (in-component-copy? parent))))))
|
||||
|
|
|
@ -709,8 +709,8 @@
|
|||
(let [page (wsh/lookup-page state)
|
||||
objects (:objects page)
|
||||
selected (->> (wsh/lookup-selected state)
|
||||
(map #(get objects %))
|
||||
(remove #(ctk/in-component-copy-not-root? %)) ;; We don't want to change the structure of component copies
|
||||
(map (d/getf objects))
|
||||
(filter #(ctk/allow-duplicate? objects %))
|
||||
(map :id)
|
||||
set)]
|
||||
(when (seq selected)
|
||||
|
|
Loading…
Add table
Reference in a new issue