From 109ce2ad3c7554d9a23fd2161ed16a8f9b255193 Mon Sep 17 00:00:00 2001 From: Yakov-Botov <55227000+Yakov-Botov@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:29:20 +0500 Subject: [PATCH] fix: improve clipboard fallback fn usage (#180) --- src/clipboard.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clipboard.ts b/src/clipboard.ts index 4836d58d..ec75ef9a 100644 --- a/src/clipboard.ts +++ b/src/clipboard.ts @@ -47,7 +47,7 @@ function copyWithFakeElement(text: string): Promise { export function copyTextToClipboard(text: string): Promise { if (navigator.clipboard) { - return copyWithNavigator(text); + return copyWithNavigator(text).catch(() => copyWithFakeElement(text)); } else { return copyWithFakeElement(text); }