From 723cb3b5464949a2d3115fd333bf21da1aa07fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Wed, 30 Jun 2021 09:52:53 +0200 Subject: [PATCH] :sparkles: Detach typographies when deleted in the file library --- CHANGES.md | 1 + frontend/src/app/main/data/workspace/libraries_helpers.cljs | 3 ++- frontend/src/app/main/ui/workspace/sidebar/assets.cljs | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a19de1b6dc..4d477357e7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ - Process numeric input changes only if the value actually changed. - Remove unnecesary redirect from history when user goes to workspace from dashboard [Taiga #1820](https://tree.taiga.io/project/penpot/issue/1820). +- Detach shapes from deleted assets [Taiga #1850](https://tree.taiga.io/project/penpot/issue/1850). - Fix tooltip position on view application [Taiga #1819](https://tree.taiga.io/project/penpot/issue/1819). - Fix dashboard navigation on moving file to other team [Taiga #1817](https://tree.taiga.io/project/penpot/issue/1817). - Fix workspace header presence styles and invalid link [Taiga #1813](https://tree.taiga.io/project/penpot/issue/1813). diff --git a/frontend/src/app/main/data/workspace/libraries_helpers.cljs b/frontend/src/app/main/data/workspace/libraries_helpers.cljs index 4c33f41a5e..788b2453a0 100644 --- a/frontend/src/app/main/data/workspace/libraries_helpers.cljs +++ b/frontend/src/app/main/data/workspace/libraries_helpers.cljs @@ -499,7 +499,8 @@ update-node (fn [node] (if-let [typography (get typographies (:typography-ref-id node))] (merge node (d/without-keys typography [:name :id])) - node))] + (dissoc node :typography-ref-id + :typography-ref-file)))] (generate-sync-text-shape shape container update-node))) (defn- get-assets diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index 2acde247d5..766c6cda30 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -1252,7 +1252,10 @@ (fn [] (if (or multi-typographies? multi-assets?) (on-assets-delete) - (st/emit! (dwl/delete-typography (:id @state)))))) + (st/emit! (dwu/start-undo-transaction) + (dwl/delete-typography (:id @state)) + (dwl/sync-file file-id file-id) + (dwu/commit-undo-transaction))))) editting-id (or (:rename-typography local) (:edit-typography local))]