diff --git a/frontend/src/app/main/ui/workspace/effects.cljs b/frontend/src/app/main/ui/workspace/effects.cljs index dbc85952a..668de1b2f 100644 --- a/frontend/src/app/main/ui/workspace/effects.cljs +++ b/frontend/src/app/main/ui/workspace/effects.cljs @@ -53,6 +53,7 @@ button (.-which (.-nativeEvent event)) shift? (kbd/shift? event) ctrl? (kbd/ctrl? event)] + (dom/prevent-default event) (when-not blocked (cond (or (not= 1 button) drawing? ctrl?) diff --git a/frontend/src/app/main/ui/workspace/viewport.cljs b/frontend/src/app/main/ui/workspace/viewport.cljs index ef6a7e354..ed0815c25 100644 --- a/frontend/src/app/main/ui/workspace/viewport.cljs +++ b/frontend/src/app/main/ui/workspace/viewport.cljs @@ -252,6 +252,7 @@ viewport-ref (mf/use-ref nil) zoom-view-ref (mf/use-ref nil) last-position (mf/use-var nil) + disable-paste (mf/use-var false) drawing (mf/deref refs/workspace-drawing) drawing-tool (:tool drawing) drawing-obj (:object drawing) @@ -301,6 +302,10 @@ (when (= 2 (.-which event)) (do (dom/prevent-default event) + + ;; We store this so in Firefox the middle button won't do a paste of the content + (reset! disable-paste true) + (timers/schedule #(reset! disable-paste false)) (st/emit! dw/finish-pan ::finish-positioning)))))) @@ -529,7 +534,10 @@ on-paste (mf/use-callback (fn [event] - (st/emit! (dw/paste-from-event event)))) + ;; We disable the paste just after mouse-up of a middle button so when panning won't + ;; paste the content into the workspace + (when (not @disable-paste) + (st/emit! (dw/paste-from-event event))))) on-resize (mf/use-callback