mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
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:
@@ -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 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 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 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
|
## 2.8.0
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,8 @@
|
|||||||
is-component? (and single? has-component?)
|
is-component? (and single? has-component?)
|
||||||
has-variant? (some ctc/is-variant? selected-shapes)
|
has-variant? (some ctc/is-variant? selected-shapes)
|
||||||
|
|
||||||
|
has-layout? (and single? (ctl/any-layout? (first selected-shapes)))
|
||||||
|
|
||||||
new-shape-id (uuid/next)
|
new-shape-id (uuid/next)
|
||||||
undo-id (js/Symbol)]
|
undo-id (js/Symbol)]
|
||||||
|
|
||||||
@@ -188,7 +190,8 @@
|
|||||||
(rx/empty)
|
(rx/empty)
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(rx/of (dwu/start-undo-transaction undo-id))
|
(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:
|
;; Create layout from a group:
|
||||||
;; When creating a layout from a group we remove the group and create the layout with its children
|
;; 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))
|
(let [parent-id (:parent-id (first selected-shapes))
|
||||||
@@ -206,7 +209,14 @@
|
|||||||
(ptk/data-event :layout/update {:ids [new-shape-id]})
|
(ptk/data-event :layout/update {:ids [new-shape-id]})
|
||||||
(dwu/commit-undo-transaction undo-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
|
;; Create Layout from selection
|
||||||
|
:else
|
||||||
(rx/of
|
(rx/of
|
||||||
(dwsh/create-artboard-from-selection new-shape-id)
|
(dwsh/create-artboard-from-selection new-shape-id)
|
||||||
(cl/remove-all-fills [new-shape-id] {:color clr/black :opacity 1})
|
(cl/remove-all-fills [new-shape-id] {:color clr/black :opacity 1})
|
||||||
|
|||||||
Reference in New Issue
Block a user