mirror of
https://github.com/penpot/penpot.git
synced 2025-07-27 06:47:23 +02:00
✨ Remove copying props for multiple elements (#5700)
This commit is contained in:
parent
1ebd5be3b1
commit
34e2eb829b
2 changed files with 44 additions and 39 deletions
|
@ -1568,9 +1568,13 @@
|
||||||
(js/console.error "clipboard blocked:" error)
|
(js/console.error "clipboard blocked:" error)
|
||||||
(rx/empty))]
|
(rx/empty))]
|
||||||
|
|
||||||
|
(let [selected (dsh/lookup-selected state)]
|
||||||
|
(if (> (count selected) 1)
|
||||||
|
;; If multiple items are selected don't do anything
|
||||||
|
(rx/empty)
|
||||||
|
|
||||||
(let [selected (->> (dsh/lookup-selected state) first)
|
(let [selected (->> (dsh/lookup-selected state) first)
|
||||||
objects (dsh/lookup-page-objects state)]
|
objects (dsh/lookup-page-objects state)]
|
||||||
|
|
||||||
(when-let [shape (get objects selected)]
|
(when-let [shape (get objects selected)]
|
||||||
(let [props (cts/extract-props shape)
|
(let [props (cts/extract-props shape)
|
||||||
features (-> (features/get-team-enabled-features state)
|
features (-> (features/get-team-enabled-features state)
|
||||||
|
@ -1609,7 +1613,7 @@
|
||||||
(rx/mapcat resolve-images)
|
(rx/mapcat resolve-images)
|
||||||
(rx/map #(wapi/write-to-clipboard (t/encode-str % {:type :json-verbose})))
|
(rx/map #(wapi/write-to-clipboard (t/encode-str % {:type :json-verbose})))
|
||||||
(rx/catch on-copy-error)
|
(rx/catch on-copy-error)
|
||||||
(rx/ignore))))))))))
|
(rx/ignore))))))))))))
|
||||||
|
|
||||||
(defn paste-selected-props
|
(defn paste-selected-props
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
(mf/defc context-menu-edit*
|
(mf/defc context-menu-edit*
|
||||||
{::mf/props :obj
|
{::mf/props :obj
|
||||||
::mf/private true}
|
::mf/private true}
|
||||||
[]
|
[{:keys [shapes]}]
|
||||||
(let [do-copy #(st/emit! (dw/copy-selected))
|
(let [do-copy #(st/emit! (dw/copy-selected))
|
||||||
do-copy-link #(st/emit! (dw/copy-link-to-clipboard))
|
do-copy-link #(st/emit! (dw/copy-link-to-clipboard))
|
||||||
|
|
||||||
|
@ -206,6 +206,7 @@
|
||||||
|
|
||||||
[:> menu-entry* {:title (tr "workspace.shape.menu.copy-props")
|
[:> menu-entry* {:title (tr "workspace.shape.menu.copy-props")
|
||||||
:shortcut (sc/get-tooltip :copy-props)
|
:shortcut (sc/get-tooltip :copy-props)
|
||||||
|
:disabled (> (count shapes) 1)
|
||||||
:on-click handle-copy-props}]
|
:on-click handle-copy-props}]
|
||||||
[:> menu-entry* {:title (tr "workspace.shape.menu.paste-props")
|
[:> menu-entry* {:title (tr "workspace.shape.menu.paste-props")
|
||||||
:shortcut (sc/get-tooltip :paste-props)
|
:shortcut (sc/get-tooltip :paste-props)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue