diff --git a/src/main.ts b/src/main.ts index 38da3ec..46768b8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -671,74 +671,6 @@ class MotifApp { this.status.textContent = message; } - private cleanTitleForShare(title: string): string { - return (title || '') - .replace(/\.mid$/i, '') - .replace(/_/g, ' ') - .replace(/\s+/g, ' ') - .trim() - .slice(0, 200); - } - - private async copyToClipboard(text: string): Promise { - // Try modern clipboard API first - if (navigator.clipboard?.writeText) { - try { - await navigator.clipboard.writeText(text); - return; - } catch { - // Fall through to textarea method - } - } - - // Fallback for iOS Safari and older browsers - const ta = document.createElement('textarea'); - ta.value = text; - ta.style.position = 'fixed'; - ta.style.top = '0'; - ta.style.left = '0'; - ta.style.width = '2em'; - ta.style.height = '2em'; - ta.style.padding = '0'; - ta.style.border = 'none'; - ta.style.outline = 'none'; - ta.style.boxShadow = 'none'; - ta.style.background = 'transparent'; - ta.style.fontSize = '16px'; // Prevent zoom on iOS - ta.setAttribute('readonly', ''); - document.body.appendChild(ta); - - // iOS needs special handling - const isiOS = /ipad|iphone|ipod/i.test(navigator.userAgent); - if (isiOS) { - ta.contentEditable = 'true'; - ta.readOnly = false; - const range = document.createRange(); - range.selectNodeContents(ta); - const sel = window.getSelection(); - if (sel) { - sel.removeAllRanges(); - sel.addRange(range); - } - ta.setSelectionRange(0, 999999); - } else { - ta.select(); - } - - let success = false; - try { - success = document.execCommand('copy'); - } catch { - // ignore - } - - document.body.removeChild(ta); - - if (!success) { - throw new Error('Copy failed'); - } - } - private handleCopyLink(): void { if (!this.hasGenerated) return; const result = this.searchResults[this.selectedResultIndex];