mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
commit
5e6ce26742
5 changed files with 36 additions and 20 deletions
|
@ -202,7 +202,7 @@
|
||||||
(when (some? head-component)
|
(when (some? head-component)
|
||||||
(get-ref-shape (:data head-file) head-component shape))))]
|
(get-ref-shape (:data head-file) head-component shape))))]
|
||||||
|
|
||||||
(d/seek find-ref-shape-in-head parent-heads)))
|
(some find-ref-shape-in-head parent-heads)))
|
||||||
|
|
||||||
(defn find-remote-shape
|
(defn find-remote-shape
|
||||||
"Recursively go back by the :shape-ref of the shape until find the correct shape of the original component"
|
"Recursively go back by the :shape-ref of the shape until find the correct shape of the original component"
|
||||||
|
|
|
@ -617,16 +617,19 @@
|
||||||
selected (->> state
|
selected (->> state
|
||||||
(wsh/lookup-selected)
|
(wsh/lookup-selected)
|
||||||
(cfh/clean-loops objects))
|
(cfh/clean-loops objects))
|
||||||
|
selected-objects (map #(get objects %) selected)
|
||||||
changes (reduce
|
can-detach? (every? #(not (ctn/has-any-copy-parent? objects %)) selected-objects)
|
||||||
|
changes (when can-detach?
|
||||||
|
(reduce
|
||||||
(fn [changes id]
|
(fn [changes id]
|
||||||
(dwlh/generate-detach-instance changes libraries container id))
|
(dwlh/generate-detach-instance changes libraries container id))
|
||||||
(-> (pcb/empty-changes it)
|
(-> (pcb/empty-changes it)
|
||||||
(pcb/with-container container)
|
(pcb/with-container container)
|
||||||
(pcb/with-objects objects))
|
(pcb/with-objects objects))
|
||||||
selected)]
|
selected))]
|
||||||
|
|
||||||
(rx/of (dch/commit-changes changes))))))
|
(rx/of (when can-detach?
|
||||||
|
(dch/commit-changes changes)))))))
|
||||||
|
|
||||||
(defn nav-to-component-file
|
(defn nav-to-component-file
|
||||||
[file-id component]
|
[file-id component]
|
||||||
|
|
|
@ -355,6 +355,9 @@
|
||||||
(not (ctn/has-any-copy-parent? objects shape))
|
(not (ctn/has-any-copy-parent? objects shape))
|
||||||
(cfh/component-touched? objects (:id shape)))))
|
(cfh/component-touched? objects (:id shape)))))
|
||||||
|
|
||||||
|
can-detach? (and (seq copies)
|
||||||
|
(every? #(not (ctn/has-any-copy-parent? objects %)) copies))
|
||||||
|
|
||||||
|
|
||||||
do-detach-component
|
do-detach-component
|
||||||
#(st/emit! (dwl/detach-components (map :id copies)))
|
#(st/emit! (dwl/detach-components (map :id copies)))
|
||||||
|
@ -420,7 +423,7 @@
|
||||||
(when (and (not multi) main-instance? local-component? lacks-annotation? components-v2)
|
(when (and (not multi) main-instance? local-component? lacks-annotation? components-v2)
|
||||||
{:msg "workspace.shape.menu.create-annotation"
|
{:msg "workspace.shape.menu.create-annotation"
|
||||||
:action do-create-annotation})
|
:action do-create-annotation})
|
||||||
(when (seq copies)
|
(when can-detach?
|
||||||
{:msg (if (> (count copies) 1)
|
{:msg (if (> (count copies) 1)
|
||||||
"workspace.shape.menu.detach-instances-in-bulk"
|
"workspace.shape.menu.detach-instances-in-bulk"
|
||||||
"workspace.shape.menu.detach-instance")
|
"workspace.shape.menu.detach-instance")
|
||||||
|
|
|
@ -522,7 +522,8 @@
|
||||||
(when open?
|
(when open?
|
||||||
[:div {:class (stl/css :element-content)}
|
[:div {:class (stl/css :element-content)}
|
||||||
[:div {:class (stl/css-case :component-wrapper true
|
[:div {:class (stl/css-case :component-wrapper true
|
||||||
:with-actions show-menu?)}
|
:with-actions show-menu?
|
||||||
|
:without-actions (not show-menu?))}
|
||||||
[:button {:class (stl/css-case :component-name-wrapper true
|
[:button {:class (stl/css-case :component-name-wrapper true
|
||||||
:with-main (and can-swap? (not multi))
|
:with-main (and can-swap? (not multi))
|
||||||
:swappeable (and can-swap? (not swap-opened?)))
|
:swappeable (and can-swap? (not swap-opened?)))
|
||||||
|
|
|
@ -51,6 +51,15 @@
|
||||||
grid-template-columns: 1fr $s-28;
|
grid-template-columns: 1fr $s-28;
|
||||||
gap: $s-2;
|
gap: $s-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.without-actions {
|
||||||
|
padding-right: 0.5rem;
|
||||||
|
.component-name-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
border-radius: $br-8;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.component-name-wrapper {
|
.component-name-wrapper {
|
||||||
|
|
Loading…
Add table
Reference in a new issue