mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 16:21:57 -05:00
🐛 Avoid creating component with shapes that belong to other one
This commit is contained in:
parent
a1a0444cc7
commit
dc89610d07
1 changed files with 8 additions and 5 deletions
|
@ -10,6 +10,7 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.types.component :as ctk]
|
||||
[app.common.types.components-list :as ctkl]
|
||||
[app.common.types.file :as ctf]
|
||||
[app.common.types.page :as ctp]
|
||||
|
@ -398,6 +399,7 @@
|
|||
|
||||
has-component? (some true? (map #(contains? % :component-id) shapes))
|
||||
is-component? (and single? (-> shapes first :component-id some?))
|
||||
is-non-root? (and single? (ctk/in-component-instance-not-root? (first shapes)))
|
||||
|
||||
shape-id (-> shapes first :id)
|
||||
component-id (-> shapes first :component-id)
|
||||
|
@ -452,10 +454,12 @@
|
|||
:on-accept do-update-component-in-bulk}))]
|
||||
[:*
|
||||
[:*
|
||||
[:& menu-separator]
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.create-component")
|
||||
:shortcut (sc/get-tooltip :create-component)
|
||||
:on-click do-add-component}]
|
||||
(when (or (not is-non-root?) (and has-component? (not single?)))
|
||||
[:& menu-separator])
|
||||
(when-not is-non-root?
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.create-component")
|
||||
:shortcut (sc/get-tooltip :create-component)
|
||||
:on-click do-add-component}])
|
||||
(when (and has-component? (not single?))
|
||||
[:*
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instances-in-bulk")
|
||||
|
@ -468,7 +472,6 @@
|
|||
;; WARNING: this menu is the same as the context menu at the sidebar.
|
||||
;; If you change it, you must change equally the file
|
||||
;; app/main/ui/workspace/sidebar/options/menus/component.cljs
|
||||
|
||||
[:*
|
||||
[:& menu-separator]
|
||||
(if main-component?
|
||||
|
|
Loading…
Add table
Reference in a new issue