(state)
| 401 | } |
| 402 | |
| 403 | async function copyInlineAiResult(state) { |
| 404 | const text = state && state.result ? state.result : ''; |
| 405 | if (!text) return false; |
| 406 | if (navigator.clipboard && navigator.clipboard.writeText) { |
| 407 | await navigator.clipboard.writeText(text); |
| 408 | state.statusText = '已复制 AI 结果'; |
| 409 | return true; |
| 410 | } |
| 411 | const input = document.createElement('textarea'); |
| 412 | input.value = text; |
| 413 | input.style.position = 'fixed'; |
| 414 | input.style.opacity = '0'; |
| 415 | document.body.appendChild(input); |
| 416 | input.select(); |
| 417 | const ok = document.execCommand('Copy'); |
| 418 | document.body.removeChild(input); |
| 419 | state.statusText = ok ? '已复制 AI 结果' : '复制失败'; |
| 420 | return ok; |
| 421 | } |
| 422 | |
| 423 | function getInlineAiTaskFromUrl() { |
| 424 | try { |
no outgoing calls
no test coverage detected