diff --git a/CHANGES.md b/CHANGES.md index 0d4e73b65..41e1ae1f5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ - Fix custom fonts not rendered correctly [Taiga #4874](https://tree.taiga.io/project/penpot/issue/4874) - Fix problem with shadows and blur on multiple selection - Fix problem with redo shortcut +- Fix Component texts not displayed in assets panel [Taiga #4907](https://tree.taiga.io/project/penpot/issue/4907) - Fix search field has implemented shared styles for "close icon" and "search icon" [Taiga #4927](https://tree.taiga.io/project/penpot/issue/4927) - Fix Handling correctly slashes "/" in emails [Taiga #4906](https://tree.taiga.io/project/penpot/issue/4906) - Fix Change text color from selected colors [Taiga #4933](https://tree.taiga.io/project/penpot/issue/4933) diff --git a/frontend/src/app/main/render.cljs b/frontend/src/app/main/render.cljs index 7e22ea699..ff2c24ee8 100644 --- a/frontend/src/app/main/render.cljs +++ b/frontend/src/app/main/render.cljs @@ -287,7 +287,6 @@ :fill "none"} [:& shape-wrapper {:shape frame}]]])) - ;; Component for rendering a thumbnail of a single componenent. Mainly ;; used to render thumbnails on assets panel. (mf/defc component-svg @@ -334,7 +333,8 @@ :fill "none"} [:> shape-container {:shape root-shape} - [:& root-shape-wrapper {:shape root-shape :view-box vbox}]]])) + [:& (mf/provider muc/is-component?) {:value true} + [:& root-shape-wrapper {:shape root-shape :view-box vbox}]]]])) (mf/defc object-svg {::mf/wrap [mf/memo]} @@ -468,7 +468,7 @@ (let [texts (->> objects (vals) (filterv #(= (:type %) :text)) - (mapv :content)) ] + (mapv :content))] (->> (rx/from texts) (rx/map fonts/get-content-fonts) diff --git a/frontend/src/app/main/ui/context.cljs b/frontend/src/app/main/ui/context.cljs index 3b0f84bf1..244dbe9c2 100644 --- a/frontend/src/app/main/ui/context.cljs +++ b/frontend/src/app/main/ui/context.cljs @@ -27,3 +27,4 @@ (def current-zoom (mf/create-context nil)) (def workspace-read-only? (mf/create-context nil)) +(def is-component? (mf/create-context false)) diff --git a/frontend/src/app/main/ui/shapes/text.cljs b/frontend/src/app/main/ui/shapes/text.cljs index 26fdf23c7..9dda49dad 100644 --- a/frontend/src/app/main/ui/shapes/text.cljs +++ b/frontend/src/app/main/ui/shapes/text.cljs @@ -8,6 +8,8 @@ (:require [app.common.text :as txt] [app.main.fonts :as fonts] + [app.main.ui.context :as ctx] + [app.main.ui.shapes.text.fo-text :as fo] [app.main.ui.shapes.text.svg-text :as svg] [app.util.object :as obj] [rumext.v2 :as mf])) @@ -22,10 +24,13 @@ (mf/defc text-shape {::mf/wrap-props false} [props] - (let [{:keys [position-data content] :as shape} (obj/get props "shape")] + (let [{:keys [position-data content] :as shape} (obj/get props "shape") + is-component? (mf/use-ctx ctx/is-component?)] (mf/with-memo [content] (load-fonts! content)) - (when (some? position-data) - [:> svg/text-shape props]))) + ;; Old components can have texts without position data that must be rendered via foreign key + (cond + (some? position-data) [:> svg/text-shape props] + is-component? [:> fo/text-shape props])))