mirror of
https://github.com/penpot/penpot.git
synced 2025-07-13 23:37:16 +02:00
🐛 Fix paste shapes while editing text
This commit is contained in:
parent
5633291ab0
commit
1bcb0128f0
2 changed files with 19 additions and 16 deletions
|
@ -39,6 +39,7 @@
|
||||||
- Allow registration with invitation token when registration is disabled
|
- Allow registration with invitation token when registration is disabled
|
||||||
- Add the ability to disable standard, password login [Taiga #2999](https://tree.taiga.io/project/penpot/us/2999)
|
- Add the ability to disable standard, password login [Taiga #2999](https://tree.taiga.io/project/penpot/us/2999)
|
||||||
- Don't stop SVG import when an image cannot be imported [#1531](https://github.com/penpot/penpot/issues/1531)
|
- Don't stop SVG import when an image cannot be imported [#1531](https://github.com/penpot/penpot/issues/1531)
|
||||||
|
- Fix paste shapes while editing text [Taiga #2396](https://tree.taiga.io/project/penpot/issue/2396)
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
|
|
@ -1357,26 +1357,28 @@
|
||||||
edit-id (get-in state [:workspace-local :edition])
|
edit-id (get-in state [:workspace-local :edition])
|
||||||
is-editing-text? (and edit-id (= :text (get-in objects [edit-id :type])))]
|
is-editing-text? (and edit-id (= :text (get-in objects [edit-id :type])))]
|
||||||
|
|
||||||
(cond
|
;; Some paste events can be fired while we're editing a text
|
||||||
(and (string? text-data)
|
;; we forbid that scenario so the default behaviour is executed
|
||||||
(str/includes? text-data "<svg"))
|
(when-not is-editing-text?
|
||||||
(rx/of (paste-svg text-data))
|
(cond
|
||||||
|
(and (string? text-data)
|
||||||
|
(str/includes? text-data "<svg"))
|
||||||
|
(rx/of (paste-svg text-data))
|
||||||
|
|
||||||
(seq image-data)
|
(seq image-data)
|
||||||
(rx/from (map paste-image image-data))
|
(rx/from (map paste-image image-data))
|
||||||
|
|
||||||
(coll? decoded-data)
|
(coll? decoded-data)
|
||||||
(->> (rx/of decoded-data)
|
(->> (rx/of decoded-data)
|
||||||
(rx/filter #(= :copied-shapes (:type %)))
|
(rx/filter #(= :copied-shapes (:type %)))
|
||||||
(rx/map #(paste-shape % in-viewport?)))
|
(rx/map #(paste-shape % in-viewport?)))
|
||||||
|
|
||||||
;; Some paste events can be fired while we're editing a text
|
(string? text-data)
|
||||||
;; we forbid that scenario so the default behaviour is executed
|
(rx/of (paste-text text-data))
|
||||||
(and (string? text-data) (not is-editing-text?))
|
|
||||||
(rx/of (paste-text text-data))
|
:else
|
||||||
|
(rx/empty))))
|
||||||
|
|
||||||
:else
|
|
||||||
(rx/empty)))
|
|
||||||
(catch :default err
|
(catch :default err
|
||||||
(js/console.error "Clipboard error:" err))))))
|
(js/console.error "Clipboard error:" err))))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue