diff --git a/frontend/src/app/main/ui/context.cljs b/frontend/src/app/main/ui/context.cljs index 59c2631ba6..30568be47c 100644 --- a/frontend/src/app/main/ui/context.cljs +++ b/frontend/src/app/main/ui/context.cljs @@ -30,6 +30,7 @@ (def current-zoom (mf/create-context nil)) (def workspace-read-only? (mf/create-context nil)) +(def is-render? (mf/create-context false)) (def is-component? (mf/create-context false)) (def sidebar diff --git a/frontend/src/app/main/ui/shapes/text.cljs b/frontend/src/app/main/ui/shapes/text.cljs index b54af2fc8e..3610d52fe0 100644 --- a/frontend/src/app/main/ui/shapes/text.cljs +++ b/frontend/src/app/main/ui/shapes/text.cljs @@ -28,6 +28,7 @@ {::mf/wrap-props false} [props] (let [{:keys [position-data content] :as shape} (obj/get props "shape") + is-render? (mf/use-ctx ctx/is-render?) is-component? (mf/use-ctx ctx/is-component?)] (mf/with-memo [content] @@ -41,5 +42,5 @@ ;; Only use this for component preview, otherwise the dashboard thumbnails ;; will give a tainted canvas error because the `foreignObject` cannot be ;; rendered. - (and (nil? position-data) is-component?) + (and (nil? position-data) (or is-component? is-render?)) [:> fo/text-shape props]))) diff --git a/frontend/src/app/render.cljs b/frontend/src/app/render.cljs index 56509025eb..e06d9cb24f 100644 --- a/frontend/src/app/render.cljs +++ b/frontend/src/app/render.cljs @@ -18,6 +18,7 @@ [app.main.render :as render] [app.main.repo :as repo] [app.main.store :as st] + [app.main.ui.context :as ctx] [app.util.dom :as dom] [app.util.globals :as glob] [beicon.v2.core :as rx] @@ -76,11 +77,12 @@ (mth/ceil height) "px")})))) (when objects - [:& render/object-svg - {:objects objects - :object-id object-id - :embed embed - :skip-children skip-children}]))) + [:& (mf/provider ctx/is-render?) {:value true} + [:& render/object-svg + {:objects objects + :object-id object-id + :embed embed + :skip-children skip-children}]]))) (mf/defc objects-svg {::mf/wrap-props false} @@ -88,12 +90,13 @@ (when-let [objects (mf/deref ref:objects)] (for [object-id object-ids] (let [objects (render/adapt-objects-for-shape objects object-id)] - [:& render/object-svg - {:objects objects - :key (str object-id) - :object-id object-id - :embed embed - :skip-children skip-children}])))) + [:& (mf/provider ctx/is-render?) {:value true} + [:& render/object-svg + {:objects objects + :key (str object-id) + :object-id object-id + :embed embed + :skip-children skip-children}]])))) (defn- fetch-objects-bundle [& {:keys [file-id page-id share-id object-id] :as options}]