mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-15 23:57:47 +00:00
fix(helpers) move copyText function to web.js file
It gets bundled on mobile for no reason otherwise.
This commit is contained in:
@@ -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 {
|
||||
|
||||
18
react/features/base/util/copyText.ts
Normal file
18
react/features/base/util/copyText.ts
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user