fix(combo): resolve cross-provider thinking 400 and http clipboard (#1444)

Integrated into release/v3.7.0
This commit is contained in:
diegosouzapw
2026-04-21 04:36:16 -03:00
parent b38e57d452
commit 1d3d99bb9e
3 changed files with 13 additions and 9 deletions

View File

@@ -11,13 +11,10 @@
* @returns true if copy succeeded, false otherwise
*/
export async function copyToClipboard(text: string): Promise<boolean> {
// Method 1: Clipboard API (requires HTTPS / secure context)
if (
typeof navigator !== "undefined" &&
navigator.clipboard &&
typeof window !== "undefined" &&
window.isSecureContext
) {
// Method 1: Clipboard API
// Works on HTTPS, localhost (treated as secure context), and some browsers
// even on HTTP. Try unconditionally — the catch handles failures.
if (typeof navigator !== "undefined" && navigator.clipboard) {
try {
await navigator.clipboard.writeText(text);
return true;