From aa4344a76f652b36c15ed69ff7a07c6d6b43e8fd Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Wed, 24 Aug 2022 09:39:39 +0200 Subject: [PATCH 1/2] :bug: Fix drag and drop graphic assets in groups --- CHANGES.md | 1 + .../src/app/main/ui/workspace/sidebar/assets.cljs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 04cbee7f2..2fe22e810 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -56,6 +56,7 @@ - Fix unexpected layers ungrouping on moving it [Taiga #3932](https://tree.taiga.io/project/penpot/issue/3932) by @andrewzhurov - Fix unexpected exception and behavior on colorpicker with gradients [Taiga #3448](https://tree.taiga.io/project/penpot/issue/3448) - Fix multiselection with shift not working inside a library group [Taiga #3532](https://tree.taiga.io/project/penpot/issue/3532) +- Fix drag and drop graphic assets in groups [Taiga #4002](https://tree.taiga.io/project/penpot/issue/4002) diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index aab1c95a6..ed2dcc426 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -892,6 +892,17 @@ (seq (:colors selected-assets)) (seq (:typographies selected-assets))) + extract-path-if-missing + (fn [graphic] + (let [[path name] (cph/parse-path-name (:name graphic))] + (if (and + (= (:name graphic) name) + (contains? graphic :path)) + graphic + (assoc graphic :path path :name name)))) + + objects (->> objects + (map extract-path-if-missing)) groups (group-assets objects reverse-sort?) @@ -1626,7 +1637,9 @@ extract-path-if-missing (fn [typography] (let [[path name] (cph/parse-path-name (:name typography))] - (if (= (:name typography) name) + (if (and + (= (:name typography) name) + (contains? typography :path)) typography (assoc typography :path path :name name)))) From 08ccd7be70b17662beee41be1e5db5f1a0e1c6fb Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 24 Aug 2022 14:03:38 +0200 Subject: [PATCH 2/2] :bug: Fix drag and drop boards --- frontend/src/app/main/data/workspace/transforms.cljs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 02d8d7fc8..0cf7664d3 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -16,6 +16,7 @@ [app.common.pages.common :as cpc] [app.common.pages.helpers :as cph] [app.common.spec :as us] + [app.common.uuid :as uuid] [app.main.data.workspace.changes :as dch] [app.main.data.workspace.collapse :as dwc] [app.main.data.workspace.comments :as dwcm] @@ -876,7 +877,15 @@ changes (-> (pcb/empty-changes it page-id) (pcb/with-objects objects) - (pcb/update-shapes moving-frames (fn [shape] (assoc shape :hide-in-viewer true))) + (pcb/update-shapes moving-frames (fn [shape] + ;; Hide in viwer must be enabled just when a board is moved inside another artboard an nested to it, we have to avoid situations like: + ;; - Moving inside the same frame + ;; - Moving outside the frame + (cond-> shape + (and (not= frame-id (:id shape)) + (not= frame-id (:frame-id shape)) + (not= frame-id uuid/zero)) + (assoc :hide-in-viewer true)))) (pcb/change-parent frame-id moving-shapes))] (when-not (empty? changes)