Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix: improved copy text helper function (#8677)
Calinteodor87a110b9c30f
diff --git a/react/features/base/buttons/CopyButton.js b/react/features/base/buttons/CopyButton.jsindex a99ba7cc53..c8a6256ddc 100644--- a/react/features/base/buttons/CopyButton.js+++ b/react/features/base/buttons/CopyButton.js@@ -2,9 +2,9 @@import React, { useState } from 'react';-import { translate } from '../../base/i18n';import { Icon, IconCheck, IconCopy } from '../../base/icons';-import { copyText } from '../../base/util';+import { translate } from '../i18n';+import { copyText } from '../util';type Props = {diff --git a/react/features/base/util/helpers.js b/react/features/base/util/helpers.jsindex 53c41780c4..0408c64096 100644--- a/react/features/base/util/helpers.js+++ b/react/features/base/util/helpers.js@@ -31,24 +31,15 @@ export function assignIfDefined(target: Object, source: Object) {* @param {string} textToCopy - Text to be copied.* @returns {boolean}*/-export function copyText(textToCopy: string) {- const fakeTextArea = document.createElement('textarea');+export async function copyText(textToCopy: string) {let result;- // $FlowFixMe- document.body.appendChild(fakeTextArea);- fakeTextArea.value = textToCopy;- fakeTextArea.select();-try {- result = document.execCommand('copy');+ result = await navigator.clipboard.writeText(textToCopy);} catch (err) {result = false;}- // $FlowFixMe- document.body.removeChild(fakeTextArea);-return result;}