mirror of
https://github.com/penpot/penpot.git
synced 2025-05-19 21:36:12 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
c3ce0eb794
18 changed files with 60 additions and 26 deletions
|
@ -338,7 +338,7 @@
|
|||
|
||||
(defn change-text-color
|
||||
[old-color new-color index node]
|
||||
(let [fills (:fills node)
|
||||
(let [fills (map #(dissoc % :fill-color-ref-id :fill-color-ref-file) (:fills node))
|
||||
parsed-color (d/without-nils (color-att->text old-color))
|
||||
parsed-new-color (d/without-nils (color-att->text new-color))
|
||||
has-color? (d/index-of fills parsed-color)]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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])))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue