diff --git a/CHANGES.md b/CHANGES.md index 48de72a2f9..473c1adb6d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -39,6 +39,7 @@ - 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) - 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 diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index c73c93ad25..fbf2017608 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -1357,26 +1357,28 @@ edit-id (get-in state [:workspace-local :edition]) is-editing-text? (and edit-id (= :text (get-in objects [edit-id :type])))] - (cond - (and (string? text-data) - (str/includes? text-data "> (rx/of decoded-data) - (rx/filter #(= :copied-shapes (:type %))) - (rx/map #(paste-shape % in-viewport?))) + (coll? decoded-data) + (->> (rx/of decoded-data) + (rx/filter #(= :copied-shapes (:type %))) + (rx/map #(paste-shape % in-viewport?))) - ;; 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)) + (string? text-data) + (rx/of (paste-text text-data)) + + :else + (rx/empty)))) - :else - (rx/empty))) (catch :default err (js/console.error "Clipboard error:" err))))))