function copyToClipBoard(content: string): Promise<void> {
return new Promise((resolve, reject) => {
let inputEle = document.getElementById('clipboard') as HTMLInputElement;
if (!inputEle) {
inputEle = document.createElement('input');
inputEle.id = 'clipboard';
document.body.appendChild(inputEle);
}
inputEle.setAttribute('value', content);
inputEle.style.display = 'block';
if (inputEle && inputEle.select) {
inputEle.select();
try {
const isSuccessful = document.execCommand('copy');
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
isSuccessful ? resolve() : reject();
} catch (err) {
reject(err);
}
}
inputEle.style.display = 'none';
});
}