0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Merge pull request #4742 from penpot/hiru-fix-detach-swapped-nested

Fix detach swapped nested
This commit is contained in:
Pablo Alba 2024-06-14 11:04:41 +02:00 committed by GitHub
commit 2d9c5d1ac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 10 deletions

View file

@ -45,6 +45,7 @@
- Fix open overlay relative to a frame [Taiga #7563](https://tree.taiga.io/project/penpot/issue/7563)
- Workspace-palette items stay hidden when opening with keyboard-shortcut [Taiga #7489](https://tree.taiga.io/project/penpot/issue/7489)
- Fix SVG attrs are not handled correctly when exporting/importing in .zip [Taiga #7920](https://tree.taiga.io/project/penpot/issue/7920)
- Fix validation error when detaching with two nested copies and a swap [Taiga #8095](https://tree.taiga.io/project/penpot/issue/8095)
## 2.0.3

View file

@ -269,8 +269,8 @@
; First level subinstances of a detached component can't have swap-slot
(pcb/update-shapes [shape-id] ctk/remove-swap-slot)
:always
; Near shape-refs need to be advanced one level
(nil? (ctk/get-swap-slot shape))
; Near shape-refs need to be advanced one level (except if the head is already swapped)
(generate-advance-nesting-level nil container libraries (:id shape)))
;; Otherwise, detach the shape and all children

View file

@ -277,15 +277,23 @@
(let [page-id (get state :current-page-id)
file (assoc (get state :workspace-file)
:data (get state :workspace-data))
libraries (get state :workspace-libraries)]
(ctf/dump-subtree file page-id shape-id libraries {:show-ids show-ids
:show-touched show-touched
:show-modified show-modified}))))
libraries (get state :workspace-libraries)
shape-id (if (some? shape-id)
(uuid/uuid shape-id)
(let [objects (get-in state [:workspace-data :pages-index page-id :objects])
selected (get-in state [:workspace-local :selected])]
(->> selected (map (d/getf objects)) first :id)))]
(if (some? shape-id)
(ctf/dump-subtree file page-id shape-id libraries {:show-ids show-ids
:show-touched show-touched
:show-modified show-modified})
(println "no selected shape")))))
(defn ^:export dump-subtree
([shape-id] (dump-subtree' @st/state (uuid/uuid shape-id)))
([shape-id show-ids] (dump-subtree' @st/state (uuid/uuid shape-id) show-ids false false))
([shape-id show-ids show-touched] (dump-subtree' @st/state (uuid/uuid shape-id) show-ids show-touched false))
([shape-id show-ids show-touched show-modified] (dump-subtree' @st/state (uuid/uuid shape-id) show-ids show-touched show-modified)))
([shape-id] (dump-subtree' @st/state shape-id))
([shape-id show-ids] (dump-subtree' @st/state shape-id show-ids false false))
([shape-id show-ids show-touched] (dump-subtree' @st/state shape-id show-ids show-touched false))
([shape-id show-ids show-touched show-modified] (dump-subtree' @st/state shape-id show-ids show-touched show-modified)))
(when *assert*
(defonce debug-subscription