diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2aa44e..972a6232 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file. This change #### Fixed - Right-click popup menu is positioned more accurately. See #348. +- Right-click popup menu now works in the popout window. ## 1.8.1 (2023-07-26) diff --git a/src/day8/re_frame_10x/fx/clipboard.cljs b/src/day8/re_frame_10x/fx/clipboard.cljs index c59a8bbf..ae502033 100644 --- a/src/day8/re_frame_10x/fx/clipboard.cljs +++ b/src/day8/re_frame_10x/fx/clipboard.cljs @@ -1,12 +1,15 @@ -(ns day8.re-frame-10x.fx.clipboard) +(ns day8.re-frame-10x.fx.clipboard + (:require + [day8.re-frame-10x.fx.window :refer [popout-window]])) (defn copy! [text] - (let [el (.createElement js/document "textarea")] + (let [doc (or (some-> @popout-window .-document) js/document) + el (.createElement doc "textarea")] (set! (.-value el) text) (set! (-> el .-style .-position) "absolute") (set! (-> el .-style .-left) "-9999px") - (.appendChild (.-body js/document) el) + (.appendChild (.-body doc) el) (.select el) - (.execCommand js/document "copy") - (.removeChild (.-body js/document) el))) \ No newline at end of file + (.execCommand doc "copy") + (.removeChild (.-body doc) el)))