@sendbird/uikit-react
Version:
Sendbird UIKit for React: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.
29 lines (27 loc) • 1.08 kB
JavaScript
var copyToClipboard = function (text) {
// @ts-ignore: Unreachable code error
if (window.clipboardData && window.clipboardData.setData) {
// Internet Explorer-specific code path to prevent textarea being shown while dialog is visible.
// @ts-ignore: Unreachable code error
return window.clipboardData.setData('Text', text);
}
if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
var textarea = document.createElement('textarea');
textarea.textContent = text;
textarea.style.position = 'fixed'; // Prevent scrolling to bottom of page in Microsoft Edge.
document.body.appendChild(textarea);
textarea.select();
try {
return document.execCommand('copy'); // Security exception may be thrown by some browsers.
}
catch (ex) {
return false;
}
finally {
document.body.removeChild(textarea);
}
}
return false;
};
export { copyToClipboard as c };
//# sourceMappingURL=bundle-BlL-p6Zz.js.map