chore: fix copy to clipboard (#214)

This commit is contained in:
boojack
2022-09-14 19:24:13 +08:00
committed by GitHub
parent 7079faf2b9
commit c5b26e3310
5 changed files with 15 additions and 16 deletions

View File

@ -147,18 +147,6 @@ export function filterObjectNullKeys(object: KVObject): KVObject {
return finalObject;
}
export async function copyTextToClipboard(text: string) {
if (navigator.clipboard && navigator.clipboard.writeText) {
try {
await navigator.clipboard.writeText(text);
} catch (error: unknown) {
console.warn("Copy to clipboard failed.", error);
}
} else {
console.warn("Copy to clipboard failed, methods not supports.");
}
}
export function getImageSize(src: string): Promise<{ width: number; height: number }> {
return new Promise((resolve) => {
const imgEl = new Image();