fix: remove dependency of t from clipboard and image (#7712)

* fix: remove dependency of t from clipboard and image

* pass errorMessage to copyTextToSystemClipboard where needed

* wrap copyTextToSystemClipboard and rethrow translated error in caller

* review fix

* typo
This commit is contained in:
Aakansha Doshi 2024-02-21 19:45:33 +05:30 committed by GitHub
parent 361a9449bb
commit f5ab3e4e12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 48 additions and 46 deletions

View file

@ -133,9 +133,12 @@ export const exportCanvas = async (
},
);
} else if (type === "clipboard-svg") {
await copyTextToSystemClipboard(
await svgPromise.then((svg) => svg.outerHTML),
);
const svg = await svgPromise.then((svg) => svg.outerHTML);
try {
await copyTextToSystemClipboard(svg);
} catch (e) {
throw new Error(t("errors.copyToSystemClipboardFailed"));
}
return;
}
}