0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 15:39:50 -05:00

Merge pull request #2233 from penpot/palba-fix-grouping-typographies

🐛 Fix Grouping typographies by drag & drop does not work (again)
This commit is contained in:
Alejandro 2022-09-08 08:27:26 +02:00 committed by GitHub
commit 643e58c61b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 24 deletions

View file

@ -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

View file

@ -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))]

View file

@ -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?)