mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 23:46:11 +02:00
✨ Allow to reset changes from a deleted component
This commit is contained in:
parent
5400fdb293
commit
af03f720b0
3 changed files with 17 additions and 15 deletions
|
@ -18,6 +18,7 @@
|
||||||
[app.common.types.color :as ctc]
|
[app.common.types.color :as ctc]
|
||||||
[app.common.types.component :as ctk]
|
[app.common.types.component :as ctk]
|
||||||
[app.common.types.container :as ctn]
|
[app.common.types.container :as ctn]
|
||||||
|
[app.common.types.file :as ctf]
|
||||||
[app.common.types.shape-tree :as ctst]
|
[app.common.types.shape-tree :as ctst]
|
||||||
[app.common.types.typography :as cty]
|
[app.common.types.typography :as cty]
|
||||||
[app.main.data.workspace.groups :as dwg]
|
[app.main.data.workspace.groups :as dwg]
|
||||||
|
@ -453,6 +454,11 @@
|
||||||
component (cph/get-component libraries
|
component (cph/get-component libraries
|
||||||
(:component-file shape-inst)
|
(:component-file shape-inst)
|
||||||
(:component-id shape-inst))
|
(:component-id shape-inst))
|
||||||
|
component (or component
|
||||||
|
(and reset?
|
||||||
|
(ctf/get-deleted-component
|
||||||
|
(get-in libraries [(:component-file shape-inst) :data])
|
||||||
|
(:component-id shape-inst))))
|
||||||
shape-main (when component
|
shape-main (when component
|
||||||
(ctn/get-shape component (:shape-ref shape-inst)))
|
(ctn/get-shape component (:shape-ref shape-inst)))
|
||||||
|
|
||||||
|
|
|
@ -484,9 +484,8 @@
|
||||||
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instance")
|
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instance")
|
||||||
:shortcut (sc/get-tooltip :detach-component)
|
:shortcut (sc/get-tooltip :detach-component)
|
||||||
:on-click do-detach-component}]
|
:on-click do-detach-component}]
|
||||||
;; This is commented due this functionality is not yet available
|
[:& menu-entry {:title (tr "workspace.shape.menu.reset-overrides")
|
||||||
;; [:& menu-entry {:title (tr "workspace.shape.menu.reset-overrides")
|
:on-click do-reset-component}]
|
||||||
;; :on-click do-reset-component}]
|
|
||||||
(when components-v2
|
(when components-v2
|
||||||
[:& menu-entry {:title (tr "workspace.shape.menu.restore-main")
|
[:& menu-entry {:title (tr "workspace.shape.menu.restore-main")
|
||||||
:on-click do-restore-component}])]
|
:on-click do-restore-component}])]
|
||||||
|
@ -505,9 +504,8 @@
|
||||||
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instance")
|
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instance")
|
||||||
:shortcut (sc/get-tooltip :detach-component)
|
:shortcut (sc/get-tooltip :detach-component)
|
||||||
:on-click do-detach-component}]
|
:on-click do-detach-component}]
|
||||||
;; This is commented due this functionality is not yet available
|
[:& menu-entry {:title (tr "workspace.shape.menu.reset-overrides")
|
||||||
;; [:& menu-entry {:title (tr "workspace.shape.menu.reset-overrides")
|
:on-click do-reset-component}]
|
||||||
;; :on-click do-reset-component}]
|
|
||||||
(when components-v2
|
(when components-v2
|
||||||
[:& menu-entry {:title (tr "workspace.shape.menu.restore-main")
|
[:& menu-entry {:title (tr "workspace.shape.menu.restore-main")
|
||||||
:on-click do-restore-component}])]
|
:on-click do-restore-component}])]
|
||||||
|
|
|
@ -106,23 +106,21 @@
|
||||||
(if local-component?
|
(if local-component?
|
||||||
(if is-dangling?
|
(if is-dangling?
|
||||||
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
||||||
;; [(tr "workspace.shape.menu.reset-overrides") _do-reset-component]
|
[(tr "workspace.shape.menu.reset-overrides") _do-reset-component]
|
||||||
(when components-v2
|
(when components-v2
|
||||||
[(tr "workspace.shape.menu.restore-main") do-restore-component])]
|
[(tr "workspace.shape.menu.restore-main") do-restore-component])]
|
||||||
|
|
||||||
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
||||||
;; [(tr "workspace.shape.menu.reset-overrides") _do-reset-component]
|
[(tr "workspace.shape.menu.reset-overrides") _do-reset-component]
|
||||||
[(tr "workspace.shape.menu.update-main") do-update-component]
|
[(tr "workspace.shape.menu.update-main") do-update-component]
|
||||||
[(tr "workspace.shape.menu.show-main") do-show-component]])
|
[(tr "workspace.shape.menu.show-main") do-show-component]])
|
||||||
|
|
||||||
(if is-dangling?
|
(if is-dangling?
|
||||||
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
||||||
;; [(tr "workspace.shape.menu.reset-overrides") _do-reset-component]
|
[(tr "workspace.shape.menu.reset-overrides") _do-reset-component]
|
||||||
(when components-v2
|
(when components-v2
|
||||||
[(tr "workspace.shape.menu.restore-main") do-restore-component])]
|
[(tr "workspace.shape.menu.restore-main") do-restore-component])]
|
||||||
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
[[(tr "workspace.shape.menu.detach-instance") do-detach-component]
|
||||||
;; [(tr "workspace.shape.menu.reset-overrides") _do-reset-component]
|
[(tr "workspace.shape.menu.reset-overrides") _do-reset-component]
|
||||||
;; [(tr "workspace.shape.menu.update-main") _do-update-remote-component]
|
[(tr "workspace.shape.menu.update-main") _do-update-remote-component]
|
||||||
[(tr "workspace.shape.menu.go-main") do-navigate-component-file]
|
[(tr "workspace.shape.menu.go-main") do-navigate-component-file]])))}]]]]])))
|
||||||
])))}]]]]])))
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue