FIX: copy link not working in non secure context (#25053)

In non secure contexts (HTTP vs HTTPS) which many run in development the
`clipboardCopy` method falls back to and an exec hack.

However, callers expect a promise from this method and the fallback just
returns a boolean.
This commit is contained in:
Sam 2023-12-28 10:42:23 +11:00 committed by GitHub
parent a7fe2e1a48
commit b4c1b10969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -494,7 +494,11 @@ export function clipboardCopy(text) {
}
// ...Otherwise, use document.execCommand() fallback
return clipboardCopyFallback(text);
if (clipboardCopyFallback(text)) {
return Promise.resolve();
} else {
return Promise.reject();
}
}
// Use this version of clipboardCopy if you must use an AJAX call