0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 00:10:11 -05:00

🐛 Fixes problem when pasting URL's from the browser address bar

This commit is contained in:
alonso.torres 2021-02-11 13:03:41 +01:00
parent 0a6e0d0f2c
commit 42a55015fa
2 changed files with 11 additions and 3 deletions

View file

@ -26,6 +26,7 @@
- Fix apply a color to a text selection from color palette was not working
- Fix logo icon in viewer should go to dashboard
- Fix text alignment in preview [#594](https://github.com/penpot/penpot/issues/594)
- Fix problem when pasting URL's copied from the browser url bar
### Community contributions by (Thank you! :heart:)

View file

@ -1481,11 +1481,16 @@
ptk/WatchEvent
(watch [_ state stream]
(try
(let [paste-data (wapi/read-from-paste-event event)
(let [objects (dwc/lookup-page-objects state)
paste-data (wapi/read-from-paste-event event)
image-data (wapi/extract-images paste-data)
text-data (wapi/extract-text paste-data)
decoded-data (and (t/transit? text-data)
(t/decode text-data))]
(t/decode text-data))
edit-id (get-in state [:workspace-local :edition])
is-editing-text? (and edit-id (= :text (get-in objects [edit-id :type])))]
(cond
(seq image-data)
(rx/from (map paste-image image-data))
@ -1495,7 +1500,9 @@
(rx/filter #(= :copied-shapes (:type %)))
(rx/map #(paste-shape % in-viewport?)))
(string? text-data)
;; Some paste events can be fired while we're editing a text
;; we forbid that scenario so the default behaviour is executed
(and (string? text-data) (not is-editing-text?))
(rx/of (paste-text text-data))
:else