mirror of
https://github.com/penpot/penpot.git
synced 2025-02-15 03:28:25 -05:00
🐛 Fix problems updating texts (#3765)
This commit is contained in:
parent
761dd9d6c1
commit
ce1bf49606
3 changed files with 11 additions and 9 deletions
|
@ -220,11 +220,13 @@
|
||||||
(swap! loading dissoc font-id)
|
(swap! loading dissoc font-id)
|
||||||
(resolve font-id))
|
(resolve font-id))
|
||||||
|
|
||||||
load-p (p/create
|
load-p (->> (p/create
|
||||||
(fn [resolve _]
|
(fn [resolve _]
|
||||||
(-> font
|
(-> font
|
||||||
(assoc ::on-loaded (partial on-load resolve))
|
(assoc ::on-loaded (partial on-load resolve))
|
||||||
(load-font))))]
|
(load-font))))
|
||||||
|
;; We need to wait for the font to be loaded
|
||||||
|
(p/delay 120))]
|
||||||
|
|
||||||
(swap! loading assoc font-id load-p)
|
(swap! loading assoc font-id load-p)
|
||||||
load-p))))))
|
load-p))))))
|
||||||
|
|
|
@ -119,8 +119,8 @@
|
||||||
(defn text-properties-equal?
|
(defn text-properties-equal?
|
||||||
[shape other]
|
[shape other]
|
||||||
(or (identical? shape other)
|
(or (identical? shape other)
|
||||||
(and (= (dm/get-prop shape :grow-type) (dm/get-prop other :grow-type))
|
(and (= (:grow-type shape) (:grow-type other))
|
||||||
(= (dm/get-prop shape :content) (dm/get-prop other :content))
|
(= (:content shape) (:content other))
|
||||||
;; Check if the position and size is close. If any of these changes the shape has changed
|
;; 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
|
;; and if not there is no geometry relevant change
|
||||||
(mth/close? (dm/get-prop shape :x) (dm/get-prop other :x))
|
(mth/close? (dm/get-prop shape :x) (dm/get-prop other :x))
|
||||||
|
@ -132,6 +132,7 @@
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
[props]
|
[props]
|
||||||
(let [text-shapes (unchecked-get props "text-shapes")
|
(let [text-shapes (unchecked-get props "text-shapes")
|
||||||
|
|
||||||
prev-text-shapes (hooks/use-previous 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
|
;; We store in the state the texts still pending to be calculated so we can
|
||||||
|
@ -295,7 +296,7 @@
|
||||||
(into {}
|
(into {}
|
||||||
(keep (fn [[id modifiers]]
|
(keep (fn [[id modifiers]]
|
||||||
(when-let [shape (get text-shapes id)]
|
(when-let [shape (get text-shapes id)]
|
||||||
(vector id (merge shape modifiers)))))
|
(vector id (d/patch-object shape modifiers)))))
|
||||||
modifiers)))]
|
modifiers)))]
|
||||||
|
|
||||||
;; We only need the effect to run on "mount" because the next fonts will be changed when the texts are
|
;; We only need the effect to run on "mount" because the next fonts will be changed when the texts are
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
font-id (dom/get-property-value styles "--font-id")]
|
font-id (dom/get-property-value styles "--font-id")]
|
||||||
|
|
||||||
(->> (fonts/ensure-loaded! font-id)
|
(->> (fonts/ensure-loaded! font-id)
|
||||||
(p/delay 125)
|
|
||||||
(p/fmap (fn []
|
(p/fmap (fn []
|
||||||
(when-not ^boolean (dom/check-font? font)
|
(when-not ^boolean (dom/check-font? font)
|
||||||
(load-font font))))
|
(load-font font))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue