mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 00:10:11 -05:00
🐛 Fix copy paste texts with typography assets linked
This commit is contained in:
parent
c59fc87fc4
commit
9f8d86a80e
3 changed files with 20 additions and 3 deletions
|
@ -67,6 +67,7 @@
|
||||||
- Fix paths not flagged as modified when resized [Taiga #4742](https://tree.taiga.io/project/penpot/issue/4742)
|
- Fix paths not flagged as modified when resized [Taiga #4742](https://tree.taiga.io/project/penpot/issue/4742)
|
||||||
- Fix resend invitation doesn't reset the expiration date [Taiga #4741](https://tree.taiga.io/project/penpot/issue/4741)
|
- Fix resend invitation doesn't reset the expiration date [Taiga #4741](https://tree.taiga.io/project/penpot/issue/4741)
|
||||||
- Fix incorrect state after undo page creation [Taiga #4690](https://tree.taiga.io/project/penpot/issue/4690)
|
- Fix incorrect state after undo page creation [Taiga #4690](https://tree.taiga.io/project/penpot/issue/4690)
|
||||||
|
- Fix copy paste texts with typography assets linked [Taiga #4750](https://tree.taiga.io/project/penpot/issue/4750)
|
||||||
|
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
|
|
||||||
|
|
|
@ -70,3 +70,14 @@
|
||||||
remap-typography
|
remap-typography
|
||||||
content)))))
|
content)))))
|
||||||
|
|
||||||
|
(defn remove-external-typographies
|
||||||
|
"Change the shape so that any use of an external typography now is removed"
|
||||||
|
[shape file-id]
|
||||||
|
(let [remove-ref-file #(dissoc % :typography-ref-file :typography-ref-id)]
|
||||||
|
|
||||||
|
(update shape :content
|
||||||
|
(fn [content]
|
||||||
|
(txt/transform-nodes #(not= (:typography-ref-file %) file-id)
|
||||||
|
remove-ref-file
|
||||||
|
content)))))
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
[app.common.types.shape-tree :as ctst]
|
[app.common.types.shape-tree :as ctst]
|
||||||
[app.common.types.shape.layout :as ctl]
|
[app.common.types.shape.layout :as ctl]
|
||||||
|
[app.common.types.typography :as ctt]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.main.data.comments :as dcm]
|
[app.main.data.comments :as dcm]
|
||||||
|
@ -1550,7 +1551,8 @@
|
||||||
|
|
||||||
;; Proceed with the standard shape paste process.
|
;; Proceed with the standard shape paste process.
|
||||||
(do-paste [it state mouse-pos media]
|
(do-paste [it state mouse-pos media]
|
||||||
(let [page (wsh/lookup-page state)
|
(let [file-id (:current-file-id state)
|
||||||
|
page (wsh/lookup-page state)
|
||||||
media-idx (d/index-by :prev-id media)
|
media-idx (d/index-by :prev-id media)
|
||||||
|
|
||||||
;; Calculate position for the pasted elements
|
;; Calculate position for the pasted elements
|
||||||
|
@ -1565,7 +1567,10 @@
|
||||||
;; if foreign instance, detach the shape
|
;; if foreign instance, detach the shape
|
||||||
(cond-> (foreign-instance? shape paste-objects state)
|
(cond-> (foreign-instance? shape paste-objects state)
|
||||||
(dissoc :component-id :component-file :component-root?
|
(dissoc :component-id :component-file :component-root?
|
||||||
:remote-synced? :shape-ref :touched))))
|
:remote-synced? :shape-ref :touched))
|
||||||
|
;; if is a text, remove references to external typographies
|
||||||
|
(cond-> (= (:type shape) :text)
|
||||||
|
(ctt/remove-external-typographies file-id))))
|
||||||
|
|
||||||
paste-objects (->> paste-objects (d/mapm process-shape))
|
paste-objects (->> paste-objects (d/mapm process-shape))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue