0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 16:09:17 -05:00

🐛 Fix group typographies

https://tree.taiga.io/project/penpot/issue/3338
This commit is contained in:
Andrés Moya 2022-05-05 16:02:39 +02:00
parent b86ea5b5e2
commit 7e05b7e6d9
2 changed files with 6 additions and 23 deletions

View file

@ -221,6 +221,8 @@
ptk/WatchEvent
(watch [it state _]
(let [data (get state :workspace-data)
[path name] (cph/parse-path-name (:name typography))
typography (assoc typography :path path :name name)
changes (-> (pcb/empty-changes it)
(pcb/with-library-data data)
(pcb/update-typography typography))]

View file

@ -462,21 +462,13 @@
name-input-ref (mf/use-ref)
on-change-ref (mf/use-ref nil)
name-ref (mf/use-ref (:name typography))
on-name-blur
(mf/use-callback
(mf/deps on-change)
(fn [event]
(let [content (dom/get-target-val event)]
(when-not (str/blank? content)
(let [[path name] (cph/parse-path-name content)]
(on-change {:name name :path path}))))))
on-name-change
(mf/use-callback
(fn [event]
(mf/set-ref-val! name-ref (dom/get-target-val event))))]
(let [name (dom/get-target-val event)]
(when-not (str/blank? name)
(on-change {:name name })))))]
(mf/use-effect
(mf/deps editing?)
@ -498,16 +490,6 @@
(fn []
(mf/set-ref-val! on-change-ref {:on-change on-change})))
(mf/use-effect
(fn []
(fn []
(let [content (mf/ref-val name-ref)]
;; On destroy we check if it changed
(when (and (some? content) (not= content (:name typography)))
(let [{:keys [on-change]} (mf/ref-val on-change-ref)
[path name] (cph/parse-path-name content)]
(on-change {:name name :path path})))))))
[:*
[:div.element-set-options-group.typography-entry
{:class (when selected? "selected")
@ -582,8 +564,7 @@
{:type "text"
:ref name-input-ref
:default-value (cph/merge-path-item (:path typography) (:name typography))
:on-blur on-name-blur
:on-change on-name-change}]
:on-blur on-name-blur}]
[:div.element-set-actions-button
{:on-click #(reset! open? false)}