mirror of
https://github.com/penpot/penpot.git
synced 2025-05-30 15:56:11 +02:00
Merge pull request #1017 from penpot/fix/style-block
✨ Move frame style block to workspace wrapper
This commit is contained in:
commit
71c4145ea2
2 changed files with 3 additions and 8 deletions
|
@ -8,15 +8,11 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.main.ui.shapes.attrs :as attrs]
|
[app.main.ui.shapes.attrs :as attrs]
|
||||||
[app.main.ui.shapes.text.fontfaces :as ff]
|
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
[rumext.alpha :as mf]))
|
[rumext.alpha :as mf]))
|
||||||
|
|
||||||
(def frame-default-props {:fill-color "#ffffff"})
|
(def frame-default-props {:fill-color "#ffffff"})
|
||||||
|
|
||||||
(defn is-text? [{type :type}]
|
|
||||||
(= :text type))
|
|
||||||
|
|
||||||
(defn frame-shape
|
(defn frame-shape
|
||||||
[shape-wrapper]
|
[shape-wrapper]
|
||||||
(mf/fnc frame-shape
|
(mf/fnc frame-shape
|
||||||
|
@ -26,8 +22,6 @@
|
||||||
shape (unchecked-get props "shape")
|
shape (unchecked-get props "shape")
|
||||||
{:keys [id width height]} shape
|
{:keys [id width height]} shape
|
||||||
|
|
||||||
text-childs (->> childs (filterv is-text?))
|
|
||||||
|
|
||||||
props (-> (merge frame-default-props shape)
|
props (-> (merge frame-default-props shape)
|
||||||
(attrs/extract-style-attrs)
|
(attrs/extract-style-attrs)
|
||||||
(obj/merge!
|
(obj/merge!
|
||||||
|
@ -37,7 +31,6 @@
|
||||||
:height height
|
:height height
|
||||||
:className "frame-background"}))]
|
:className "frame-background"}))]
|
||||||
[:*
|
[:*
|
||||||
[:& ff/fontfaces-style {:shapes text-childs}]
|
|
||||||
[:> :rect props]
|
[:> :rect props]
|
||||||
(for [[i item] (d/enumerate childs)]
|
(for [[i item] (d/enumerate childs)]
|
||||||
[:& shape-wrapper {:frame shape
|
[:& shape-wrapper {:frame shape
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.ui.shapes.frame :as frame]
|
[app.main.ui.shapes.frame :as frame]
|
||||||
[app.main.ui.shapes.shape :refer [shape-container]]
|
[app.main.ui.shapes.shape :refer [shape-container]]
|
||||||
|
[app.main.ui.shapes.text.fontfaces :as ff]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
[app.util.timers :as ts]
|
[app.util.timers :as ts]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
|
@ -92,11 +93,12 @@
|
||||||
(fn [node]
|
(fn [node]
|
||||||
(ts/schedule-on-idle #(reset! rendered? (some? node)))))]
|
(ts/schedule-on-idle #(reset! rendered? (some? node)))))]
|
||||||
|
|
||||||
(when (and shape (not (:hidden shape)))
|
(when (some? shape)
|
||||||
[:g.frame-wrapper {:display (when (:hidden shape) "none")}
|
[:g.frame-wrapper {:display (when (:hidden shape) "none")}
|
||||||
|
|
||||||
(when-not show-thumbnail?
|
(when-not show-thumbnail?
|
||||||
[:> shape-container {:shape shape :ref on-dom}
|
[:> shape-container {:shape shape :ref on-dom}
|
||||||
|
[:& ff/fontfaces-style {:shapes children}]
|
||||||
[:& frame-shape {:shape shape
|
[:& frame-shape {:shape shape
|
||||||
:childs children}]])
|
:childs children}]])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue