mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -05:00
Merge pull request #3331 from penpot/hiru-restore-comp-missing-lib
🐛 Disallow restore component when the library has been detached
This commit is contained in:
commit
4f02cc3e86
2 changed files with 7 additions and 2 deletions
|
@ -461,6 +461,8 @@
|
|||
is-dangling? (nil? (if local-component?
|
||||
(ctkl/get-component workspace-data component-id)
|
||||
(ctf/get-component workspace-libraries component-file component-id)))
|
||||
lib-exists? (and (not local-component?)
|
||||
(some? (get workspace-libraries component-file)))
|
||||
|
||||
do-add-component #(st/emit! (dwl/add-component))
|
||||
do-add-multiple-components #(st/emit! (dwl/add-multiple-components))
|
||||
|
@ -568,7 +570,7 @@
|
|||
(when can-update-main?
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.reset-overrides")
|
||||
:on-click do-reset-component}])
|
||||
(when components-v2
|
||||
(when (and components-v2 lib-exists?)
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.restore-main")
|
||||
:on-click do-restore-component}])]
|
||||
[:*
|
||||
|
|
|
@ -167,6 +167,9 @@
|
|||
(ctkl/get-component workspace-data component-id)
|
||||
(ctf/get-component workspace-libraries library-id component-id))
|
||||
is-dangling? (nil? component)
|
||||
lib-exists? (and (not local-component?)
|
||||
(some? (get workspace-libraries library-id)))
|
||||
|
||||
|
||||
on-menu-click
|
||||
(mf/use-callback
|
||||
|
@ -251,7 +254,7 @@
|
|||
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
||||
(when can-update-main?
|
||||
[(tr "workspace.shape.menu.reset-overrides") do-reset-component])
|
||||
(when components-v2
|
||||
(when (and components-v2 lib-exists?)
|
||||
[(tr "workspace.shape.menu.restore-main") do-restore-component])]
|
||||
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
||||
(when can-update-main?
|
||||
|
|
Loading…
Add table
Reference in a new issue