mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 12:06:12 +02:00
bug: Fix Grouping typographies by drag & drop does not work (again)
This commit is contained in:
parent
19a9440f11
commit
f7aba14f76
3 changed files with 13 additions and 24 deletions
|
@ -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))]
|
||||
|
|
|
@ -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?)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue