/** * TT-Core Clipboard Utilities * Modern clipboard operations with fallback support */ /** * Copy text to clipboard * @param {string} text - Text to copy * @returns {Promise} - Success status */ export async function copyToClipboard(text) { try { await navigator.clipboard.writeText(text || ''); return true; } catch { // Fallback for older browsers const textarea = document.createElement('textarea'); textarea.value = text || ''; textarea.style.position = 'fixed'; textarea.style.opacity = '0'; document.body.appendChild(textarea); textarea.select(); try { document.execCommand('copy'); return true; } catch { return false; } finally { document.body.removeChild(textarea); } } }