mirror of
https://github.com/penpot/penpot.git
synced 2025-05-25 04:56:11 +02:00
🐛 Fix problem ordering layers in html markup
This commit is contained in:
parent
b1e226cdc6
commit
e420be5e51
3 changed files with 19 additions and 14 deletions
|
@ -168,9 +168,10 @@
|
|||
[props]
|
||||
(let [shape (unchecked-get props "shape")
|
||||
childs (unchecked-get props "childs")
|
||||
reverse? (and (ctl/flex-layout? shape) (ctl/reverse? shape))
|
||||
childs (cond-> childs
|
||||
(ctl/any-layout? shape)
|
||||
(ctl/sort-layout-children-z-index))]
|
||||
(ctl/sort-layout-children-z-index reverse?))]
|
||||
|
||||
[:> frame-container props
|
||||
[:g.frame-children
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
([objects shape level]
|
||||
(when (and (some? shape) (some? (:selrect shape)))
|
||||
(let [indent (str/repeat " " level)
|
||||
maybe-reverse (if (ctl/any-layout? shape) reverse identity)
|
||||
|
||||
shape-html
|
||||
(cond
|
||||
|
@ -65,15 +64,18 @@
|
|||
indent)
|
||||
|
||||
:else
|
||||
(dm/fmt "%<div class=\"%\">\n%\n%</div>"
|
||||
indent
|
||||
(dm/str (d/name (:type shape)) " "
|
||||
(cgc/shape->selector shape))
|
||||
(->> (:shapes shape)
|
||||
(maybe-reverse)
|
||||
(map #(generate-html objects (get objects %) (inc level)))
|
||||
(str/join "\n"))
|
||||
indent))
|
||||
(let [children (->> shape :shapes (map #(get objects %)))
|
||||
reverse? (ctl/any-layout? shape)
|
||||
;; The order for layout elements is the reverse of SVG order
|
||||
children (cond-> children reverse? reverse)]
|
||||
(dm/fmt "%<div class=\"%\">\n%\n%</div>"
|
||||
indent
|
||||
(dm/str (d/name (:type shape)) " "
|
||||
(cgc/shape->selector shape))
|
||||
(->> children
|
||||
(map #(generate-html objects % (inc level)))
|
||||
(str/join "\n"))
|
||||
indent)))
|
||||
|
||||
shape-html
|
||||
(if (cgc/has-wrapper? objects shape)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue