mirror of
https://github.com/penpot/penpot.git
synced 2025-02-05 22:09:06 -05:00
✨ Preserve components on copy&paste when possible
This commit is contained in:
parent
e818170eec
commit
08d2dbc9bb
2 changed files with 18 additions and 9 deletions
14
CHANGES.md
14
CHANGES.md
|
@ -4,13 +4,13 @@
|
|||
|
||||
### :sparkles: New features
|
||||
|
||||
- Allow nested asset groups [Taiga #1716](https://tree.taiga.io/project/penpot/us/1716)
|
||||
- Allow to ungroup assets [Taiga #1719](https://tree.taiga.io/project/penpot/us/1719)
|
||||
- Allow to rename assets groups [Taiga #1721](https://tree.taiga.io/project/penpot/us/1721)
|
||||
- Memorize collapse state of assets in panel [Taiga #1718](https://tree.taiga.io/project/penpot/us/1718)
|
||||
- Headers button sets and menus review [Taiga #1663](https://tree.taiga.io/project/penpot/us/1663)
|
||||
- Add the ability to offload file data to a cheaper storage when file
|
||||
becomes inactive.
|
||||
- Allow nested asset groups [Taiga #1716](https://tree.taiga.io/project/penpot/us/1716).
|
||||
- Allow to ungroup assets [Taiga #1719](https://tree.taiga.io/project/penpot/us/1719).
|
||||
- Allow to rename assets groups [Taiga #1721](https://tree.taiga.io/project/penpot/us/1721).
|
||||
- Memorize collapse state of assets in panel [Taiga #1718](https://tree.taiga.io/project/penpot/us/1718).
|
||||
- Headers button sets and menus review [Taiga #1663](https://tree.taiga.io/project/penpot/us/1663).
|
||||
- Preserve components if possible, when pasted into a different file [Taiga #1063](https://tree.taiga.io/project/penpot/issue/1063).
|
||||
- Add the ability to offload file data to a cheaper storage when file becomes inactive.
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
|
|
|
@ -1537,6 +1537,15 @@
|
|||
(assoc change :index (get map-ids (:old-id change)))
|
||||
change)))
|
||||
|
||||
;; Check if the shape is an instance whose master is defined in a
|
||||
;; library that is not linked to the current file
|
||||
(foreign-instance? [shape objects state]
|
||||
(let [root (cph/get-root-shape shape objects)
|
||||
root-file-id (:component-file root)]
|
||||
(and (some? root)
|
||||
(not= root-file-id (:current-file-id state))
|
||||
(nil? (get-in state [:workspace-libraries root-file-id])))))
|
||||
|
||||
;; Procceed with the standard shape paste procediment.
|
||||
(do-paste [it state mouse-pos media]
|
||||
(let [media-idx (d/index-by :prev-id media)
|
||||
|
@ -1551,8 +1560,8 @@
|
|||
(assoc :parent-id parent-id)
|
||||
|
||||
(cond->
|
||||
;; Pasting from another file, we deattach components
|
||||
(not= (:current-file-id state) (:file-id data))
|
||||
;; if foreign instance, detach the shape
|
||||
(foreign-instance? shape objects state)
|
||||
(dissoc :component-id
|
||||
:component-file
|
||||
:component-root?
|
||||
|
|
Loading…
Add table
Reference in a new issue