Merge pull request #6886 from penpot/alotor-fix-create-layout

🐛 Fix problem when creating a layout from an existing layout
This commit is contained in:
Andrey Antukh 2025-07-10 11:28:19 +02:00 committed by GitHub
commit 66c5841d48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -21,6 +21,7 @@
- Fix text-decoration line-through that displays a wrong property value [Taiga #11145](https://tree.taiga.io/project/penpot/issue/11145)
- Fix display error message on register form [Taiga #11444](https://tree.taiga.io/project/penpot/issue/11444)
- Fix toggle focus mode did not restore viewport and selection upon exit [GitHub #6280](https://github.com/penpot/penpot/issues/6820)
- Fix problem when creating a layout from an existing layout [Taiga #11554](https://tree.taiga.io/project/penpot/issue/11554)
## 2.8.0

View file

@ -181,6 +181,8 @@
is-component? (and single? has-component?)
has-variant? (some ctc/is-variant? selected-shapes)
has-layout? (and single? (ctl/any-layout? (first selected-shapes)))
new-shape-id (uuid/next)
undo-id (js/Symbol)]
@ -188,7 +190,8 @@
(rx/empty)
(rx/concat
(rx/of (dwu/start-undo-transaction undo-id))
(if (and is-group? (not is-component?) (not is-mask?))
(cond
(and is-group? (not is-component?) (not is-mask?))
;; Create layout from a group:
;; When creating a layout from a group we remove the group and create the layout with its children
(let [parent-id (:parent-id (first selected-shapes))
@ -206,7 +209,14 @@
(ptk/data-event :layout/update {:ids [new-shape-id]})
(dwu/commit-undo-transaction undo-id)))
has-layout?
(rx/of
(create-layout-from-id (first selected) type)
(ptk/data-event :layout/update {:ids selected})
(dwu/commit-undo-transaction undo-id))
;; Create Layout from selection
:else
(rx/of
(dwsh/create-artboard-from-selection new-shape-id)
(cl/remove-all-fills [new-shape-id] {:color clr/black :opacity 1})