mirror of
https://github.com/penpot/penpot.git
synced 2025-05-31 03:36:17 +02:00
🎉 Auto select pasted objects
This commit is contained in:
parent
a4d8675a15
commit
637f0934f9
1 changed files with 11 additions and 1 deletions
|
@ -2056,6 +2056,8 @@
|
||||||
(rx/ignore)))))))
|
(rx/ignore)))))))
|
||||||
|
|
||||||
|
|
||||||
|
(declare select-pasted-objs)
|
||||||
|
|
||||||
(defn- paste-impl
|
(defn- paste-impl
|
||||||
[{:keys [selected objects] :as data}]
|
[{:keys [selected objects] :as data}]
|
||||||
(letfn [(prepare-changes [state delta]
|
(letfn [(prepare-changes [state delta]
|
||||||
|
@ -2129,7 +2131,8 @@
|
||||||
rchanges)]
|
rchanges)]
|
||||||
(rx/of (commit-changes (vec rchanges)
|
(rx/of (commit-changes (vec rchanges)
|
||||||
(vec (reverse uchanges))
|
(vec (reverse uchanges))
|
||||||
{:commit-local? true})))))))
|
{:commit-local? true})
|
||||||
|
(select-pasted-objs rchanges)))))))
|
||||||
|
|
||||||
(def paste
|
(def paste
|
||||||
(ptk/reify ::paste
|
(ptk/reify ::paste
|
||||||
|
@ -2144,6 +2147,13 @@
|
||||||
(js/console.error "Clipboard blocked:" err)
|
(js/console.error "Clipboard blocked:" err)
|
||||||
(rx/empty)))))))
|
(rx/empty)))))))
|
||||||
|
|
||||||
|
(defn select-pasted-objs
|
||||||
|
[rchanges]
|
||||||
|
(ptk/reify ::select-pasted-objs
|
||||||
|
ptk/UpdateEvent
|
||||||
|
(update [_ state]
|
||||||
|
(assoc-in state [:workspace-local :selected]
|
||||||
|
(map #(get-in % [:obj :id]) rchanges)))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Page Changes Reactions
|
;; Page Changes Reactions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue