Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(helpers) move copyText function to web.js file

Filip Rejmusc3ebde18df3d
diff --git a/react/features/base/buttons/CopyButton.tsx b/react/features/base/buttons/CopyButton.tsx
index 33271ea39d..6614d8c5c2 100644
--- a/react/features/base/buttons/CopyButton.tsx
+++ b/react/features/base/buttons/CopyButton.tsx
@@ -7,7 +7,7 @@ import React, { useEffect, useState } from 'react';
import Icon from '../icons/components/Icon';
import { IconCheck, IconCopy } from '../icons/svg';
import { withPixelLineHeight } from '../styles/functions.web';
-import { copyText } from '../util/helpers';
+import { copyText } from '../util/copyText';
const styles = (theme: Theme) => {
return {
diff --git a/react/features/base/util/copyText.ts b/react/features/base/util/copyText.ts
new file mode 100644
index 0000000000..46f1dfeb7d
--- /dev/null
+++ b/react/features/base/util/copyText.ts
@@ -0,0 +1,18 @@
+import clipboardCopy from 'clipboard-copy';
+
+/**
+ * Tries to copy a given text to the clipboard.
+ * Returns true if the action succeeds.
+ *
+ * @param {string} textToCopy - Text to be copied.
+ * @returns {Promise<boolean>}
+ */
+export async function copyText(textToCopy: string) {
+ try {
+ await clipboardCopy(textToCopy);
+
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
diff --git a/react/features/base/util/helpers.ts b/react/features/base/util/helpers.ts
index f2455023ef..ba693efa4c 100644
--- a/react/features/base/util/helpers.ts
+++ b/react/features/base/util/helpers.ts
@@ -1,5 +1,3 @@
-import clipboardCopy from 'clipboard-copy';
-
/**
* A helper function that behaves similar to Object.assign, but only reassigns a
* property in target if it's defined in source.
@@ -24,22 +22,6 @@ export function assignIfDefined(target: Object, source: Object) {
return to;
}
-/**
- * Tries to copy a given text to the clipboard.
- * Returns true if the action succeeds.
- *
- * @param {string} textToCopy - Text to be copied.
- * @returns {Promise<boolean>}
- */
-export async function copyText(textToCopy: string) {
- try {
- await clipboardCopy(textToCopy);
-
- return true;
- } catch (e) {
- return false;
- }
-}
/**
* Creates a deferred object.
diff --git a/react/features/security/components/security-dialog/web/PasswordSection.tsx b/react/features/security/components/security-dialog/web/PasswordSection.tsx
index f60ebd9395..420332cb12 100644
--- a/react/features/security/components/security-dialog/web/PasswordSection.tsx
+++ b/react/features/security/components/security-dialog/web/PasswordSection.tsx
@@ -3,7 +3,7 @@ import React, { useRef } from 'react';
import { WithTranslation } from 'react-i18next';
import { translate } from '../../../../base/i18n/functions';
-import { copyText } from '../../../../base/util/helpers';
+import { copyText } from '../../../../base/util/copyText';
import { NOTIFY_CLICK_MODE } from '../../../../toolbox/constants';
import PasswordForm from './PasswordForm';