(text: string)
| 198 | } |
| 199 | |
| 200 | function writeClipboardText(text: string): boolean { |
| 201 | if (typeof window === 'undefined') return false |
| 202 | |
| 203 | try { |
| 204 | const bridge = (window as Window & { |
| 205 | zen?: { clipboardWriteText?: (value: string) => void } |
| 206 | }).zen |
| 207 | if (typeof bridge?.clipboardWriteText === 'function') { |
| 208 | bridge.clipboardWriteText(text) |
| 209 | return true |
| 210 | } |
| 211 | |
| 212 | if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) { |
| 213 | void navigator.clipboard.writeText(text) |
| 214 | return true |
| 215 | } |
| 216 | } catch { |
| 217 | return false |
| 218 | } |
| 219 | |
| 220 | return false |
| 221 | } |
| 222 | |
| 223 | function setCopyButtonFeedback( |
| 224 | button: HTMLButtonElement, |
no test coverage detected