From 8a88f8f965b8bb659b9d931bd019f61f9a590018 Mon Sep 17 00:00:00 2001
From: "Gareth B." <71517885+bgareth@users.noreply.github.com>
Date: Fri, 14 Feb 2025 14:15:25 +0000
Subject: [PATCH 1/2] added fallback for clipboard copy and context menu paste
---
packages/core/src/modules/clipboard.ts | 5 +++++
.../react/src/components/ContextMenu/index.tsx | 14 ++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/packages/core/src/modules/clipboard.ts b/packages/core/src/modules/clipboard.ts
index a7129fc5..70d3805f 100644
--- a/packages/core/src/modules/clipboard.ts
+++ b/packages/core/src/modules/clipboard.ts
@@ -18,6 +18,11 @@ export default class clipboard {
ele.focus({ preventScroll: true });
document.execCommand("selectAll");
document.execCommand("copy");
+
+ // Fallback setup
+ const plainText = ele.innerText || ele.textContent || ""; // In order to match the clipboard which only stores the visible text without formatting
+ sessionStorage.setItem("localClipboard", plainText); // Also store in sessionStorage for fallback access
+
setTimeout(() => {
ele?.blur();
previouslyFocusedElement?.focus?.();
diff --git a/packages/react/src/components/ContextMenu/index.tsx b/packages/react/src/components/ContextMenu/index.tsx
index 640a6cd1..8a6fb237 100644
--- a/packages/react/src/components/ContextMenu/index.tsx
+++ b/packages/react/src/components/ContextMenu/index.tsx
@@ -66,9 +66,19 @@ const ContextMenu: React.FC = () => {