diff --git a/CHANGES.md b/CHANGES.md index ea6e12899..81657efec 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ - Fix problem editing rotated texts [Taiga #4026](https://tree.taiga.io/project/penpot/issue/4026) - Fix problem with texts for non existing fonts [Taiga #4087](https://tree.taiga.io/project/penpot/issue/4087) - Fix undo after moving layers will wrongly order the layers [Taiga #3344](https://tree.taiga.io/project/penpot/issue/3344) +- Fix Grouping typographies by drag & drop does not work (again) [#2203](https://github.com/penpot/penpot/issues/2203) ## 1.15.2-beta diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index de23cd4b2..92f3fea28 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -87,6 +87,15 @@ (update [_ state] (assoc-in state [:workspace-global :assets-files-open file-id :groups box path] open?)))) +(defn extract-path-if-missing + [item] + (let [[path name] (cph/parse-path-name (:name item))] + (if (and + (= (:name item) name) + (contains? item :path)) + item + (assoc item :path path :name name)))) + (defn default-color-name [color] (or (:color color) (case (get-in color [:gradient :type]) @@ -235,8 +244,7 @@ (defn- do-update-tipography [it state typography file-id] (let [data (get state :workspace-data) - [path name] (cph/parse-path-name (:name typography)) - typography (assoc typography :path path :name name) + typography (extract-path-if-missing typography) changes (-> (pcb/empty-changes it) (pcb/with-library-data data) (pcb/update-typography typography))] diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index ed2dcc426..0c730fbe5 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -891,18 +891,8 @@ multi-assets? (or (seq (:components selected-assets)) (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)) + (map dwl/extract-path-if-missing)) groups (group-assets objects reverse-sort?) @@ -1633,18 +1623,8 @@ local-data (mf/deref typography-data) menu-state (mf/use-state auto-pos-menu-state) - - extract-path-if-missing - (fn [typography] - (let [[path name] (cph/parse-path-name (:name typography))] - (if (and - (= (:name typography) name) - (contains? typography :path)) - typography - (assoc typography :path path :name name)))) - typographies (->> typographies - (map extract-path-if-missing)) + (map dwl/extract-path-if-missing)) groups (group-assets typographies reverse-sort?)