Run "make fmt"

This commit is contained in:
Michael Mayer 2021-04-30 12:28:32 +02:00
parent 28c5c1be7b
commit 3280ab38e9

View file

@ -149,11 +149,11 @@ export default class Util {
static async copyToMachineClipboard(text) {
if (window.navigator.clipboard) {
await window.navigator.clipboard.writeText(text);
} else if (document.execCommand) {
} else if (document.execCommand) {
// Clipboard is available only in HTTPS pages. see https://web.dev/async-clipboard/
// So if the the official 'clipboard' doesn't supported and the 'document.execCommand' is supported.
// copy by a work-around by creating a textarea in the DOM and execute copy command from him.
// Create the text area element (to copy from)
const clipboardElement = document.createElement("textarea");
@ -171,19 +171,19 @@ export default class Util {
// "Select" the new textarea
clipboardElement.focus();
clipboardElement.select();
// Copy the selected textarea content
const succeed = document.execCommand('copy');
const succeed = document.execCommand("copy");
// Remove the textarea from DOM
document.body.removeChild(clipboardElement);
// Validate operation succeed
if (!succeed) {
throw new Error('Failed copying to clipboard');
throw new Error("Failed copying to clipboard");
}
} else {
throw new Error('Copy to clipboard does not support in your browser');
throw new Error("Copy to clipboard does not support in your browser");
}
}
}