0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-12 18:18:24 -05:00

🐛 Fix problems updating texts (#3765)

This commit is contained in:
Alonso Torres 2023-11-06 14:29:09 +01:00 committed by GitHub
parent 761dd9d6c1
commit ce1bf49606
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View file

@ -220,11 +220,13 @@
(swap! loading dissoc font-id)
(resolve font-id))
load-p (p/create
(fn [resolve _]
(-> font
(assoc ::on-loaded (partial on-load resolve))
(load-font))))]
load-p (->> (p/create
(fn [resolve _]
(-> font
(assoc ::on-loaded (partial on-load resolve))
(load-font))))
;; We need to wait for the font to be loaded
(p/delay 120))]
(swap! loading assoc font-id load-p)
load-p))))))

View file

@ -119,8 +119,8 @@
(defn text-properties-equal?
[shape other]
(or (identical? shape other)
(and (= (dm/get-prop shape :grow-type) (dm/get-prop other :grow-type))
(= (dm/get-prop shape :content) (dm/get-prop other :content))
(and (= (:grow-type shape) (:grow-type other))
(= (:content shape) (:content other))
;; Check if the position and size is close. If any of these changes the shape has changed
;; and if not there is no geometry relevant change
(mth/close? (dm/get-prop shape :x) (dm/get-prop other :x))
@ -132,6 +132,7 @@
{::mf/wrap-props false}
[props]
(let [text-shapes (unchecked-get props "text-shapes")
prev-text-shapes (hooks/use-previous text-shapes)
;; We store in the state the texts still pending to be calculated so we can
@ -295,7 +296,7 @@
(into {}
(keep (fn [[id modifiers]]
(when-let [shape (get text-shapes id)]
(vector id (merge shape modifiers)))))
(vector id (d/patch-object shape modifiers)))))
modifiers)))]
;; We only need the effect to run on "mount" because the next fonts will be changed when the texts are

View file

@ -53,7 +53,6 @@
font-id (dom/get-property-value styles "--font-id")]
(->> (fonts/ensure-loaded! font-id)
(p/delay 125)
(p/fmap (fn []
(when-not ^boolean (dom/check-font? font)
(load-font font))))