mirror of
https://github.com/penpot/penpot.git
synced 2025-05-20 03:06:11 +02:00
Merge pull request #5553 from penpot/niwinz-bugfix-4
Fix incorrect navigate event on component show main instance action
This commit is contained in:
commit
307834b276
2 changed files with 9 additions and 12 deletions
|
@ -15,7 +15,6 @@
|
||||||
[app.common.types.container :as ctn]
|
[app.common.types.container :as ctn]
|
||||||
[app.common.types.page :as ctp]
|
[app.common.types.page :as ctp]
|
||||||
[app.common.types.shape.layout :as ctl]
|
[app.common.types.shape.layout :as ctl]
|
||||||
[app.common.uuid :as uuid]
|
|
||||||
[app.main.data.event :as ev]
|
[app.main.data.event :as ev]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
[app.main.data.shortcuts :as scd]
|
[app.main.data.shortcuts :as scd]
|
||||||
|
@ -26,7 +25,6 @@
|
||||||
[app.main.data.workspace.shape-layout :as dwsl]
|
[app.main.data.workspace.shape-layout :as dwsl]
|
||||||
[app.main.data.workspace.shapes :as dwsh]
|
[app.main.data.workspace.shapes :as dwsh]
|
||||||
[app.main.data.workspace.shortcuts :as sc]
|
[app.main.data.workspace.shortcuts :as sc]
|
||||||
[app.main.features :as features]
|
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||||
|
@ -486,15 +484,13 @@
|
||||||
:on-click on-add-layout}]]))]))
|
:on-click on-add-layout}]]))]))
|
||||||
|
|
||||||
(mf/defc context-menu-component*
|
(mf/defc context-menu-component*
|
||||||
{::mf/props :obj
|
{:mf/private true}
|
||||||
::mf/private true}
|
|
||||||
[{:keys [shapes]}]
|
[{:keys [shapes]}]
|
||||||
(let [components-v2 (features/use-feature "components/v2")
|
(let [single? (= (count shapes) 1)
|
||||||
single? (= (count shapes) 1)
|
|
||||||
objects (deref refs/workspace-page-objects)
|
objects (deref refs/workspace-page-objects)
|
||||||
can-make-component (every? true? (map #(ctn/valid-shape-for-component? objects %) shapes))
|
can-make-component (every? true? (map #(ctn/valid-shape-for-component? objects %) shapes))
|
||||||
heads (filter ctk/instance-head? shapes)
|
heads (filter ctk/instance-head? shapes)
|
||||||
components-menu-entries (cmm/generate-components-menu-entries heads components-v2)
|
components-menu-entries (cmm/generate-components-menu-entries heads true)
|
||||||
do-add-component #(st/emit! (dwl/add-component))
|
do-add-component #(st/emit! (dwl/add-component))
|
||||||
do-add-multiple-components #(st/emit! (dwl/add-multiple-components))]
|
do-add-multiple-components #(st/emit! (dwl/add-multiple-components))]
|
||||||
[:*
|
[:*
|
||||||
|
@ -511,11 +507,12 @@
|
||||||
|
|
||||||
(when (seq components-menu-entries)
|
(when (seq components-menu-entries)
|
||||||
[:*
|
[:*
|
||||||
[:> menu-separator* {}]
|
[:> menu-separator*]
|
||||||
(for [entry components-menu-entries :when (not (nil? entry))]
|
(for [entry (filter some? components-menu-entries)]
|
||||||
[:> menu-entry* {:key (uuid/next)
|
[:> menu-entry* {:key (:title entry)
|
||||||
:title (:title entry)
|
:title (:title entry)
|
||||||
:shortcut (when (contains? entry :shortcut) (sc/get-tooltip (:shortcut entry)))
|
:shortcut (when (contains? entry :shortcut)
|
||||||
|
(sc/get-tooltip (:shortcut entry)))
|
||||||
:on-click (:action entry)}])])]))
|
:on-click (:action entry)}])])]))
|
||||||
|
|
||||||
(mf/defc context-menu-delete*
|
(mf/defc context-menu-delete*
|
||||||
|
|
|
@ -399,7 +399,7 @@
|
||||||
#(st/emit! (dw/set-annotations-id-for-create id))
|
#(st/emit! (dw/set-annotations-id-for-create id))
|
||||||
|
|
||||||
do-show-local-component
|
do-show-local-component
|
||||||
#(st/emit! (dwl/go-to-local-component component-id))
|
#(st/emit! (dwl/go-to-local-component :id component-id))
|
||||||
|
|
||||||
;; When the show-remote is after a restore, the component may still be deleted
|
;; When the show-remote is after a restore, the component may still be deleted
|
||||||
do-show-remote-component
|
do-show-remote-component
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue