diff --git a/frontend/src/app/main/ui/viewer.cljs b/frontend/src/app/main/ui/viewer.cljs index e8204b59e..3bb8ad2c9 100644 --- a/frontend/src/app/main/ui/viewer.cljs +++ b/frontend/src/app/main/ui/viewer.cljs @@ -9,9 +9,12 @@ [app.common.data :as d] [app.common.exceptions :as ex] [app.common.geom.point :as gpt] + [app.common.pages.helpers :as cph] + [app.common.text :as txt] [app.main.data.comments :as dcm] [app.main.data.viewer :as dv] [app.main.data.viewer.shortcuts :as sc] + [app.main.fonts :as fonts] [app.main.refs :as refs] [app.main.store :as st] [app.main.ui.hooks :as hooks] @@ -75,6 +78,12 @@ (fn [] (get-in data [:pages page-id]))) + text-shapes + (hooks/use-equal-memo + (->> (:objects page) + (vals) + (filter cph/text-shape?))) + zoom (:zoom local) frames (:frames page) frame (get frames index) @@ -219,6 +228,13 @@ nil)))) + (mf/use-effect + (mf/deps text-shapes) + (fn [] + (let [text-nodes (->> text-shapes (mapcat #(txt/node-seq txt/is-text-node? (:content %)))) + fonts (into #{} (keep :font-id) text-nodes)] + (run! fonts/ensure-loaded! fonts)))) + [:div#viewer-layout {:class (dom/classnames :force-visible (:show-thumbnails local) :viewer-layout (not= section :handoff)