mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 10:32:45 +08:00
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:
parent
a7fe2e1a48
commit
b4c1b10969
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user