(taskId)
| 111 | |
| 112 | /* ---------------- Modal open/close ---------------- */ |
| 113 | async function openTask(taskId) { |
| 114 | const data = await fetchJSON(`${API_BASE}/tasks/${taskId}`); |
| 115 | currentTaskId = data.id; |
| 116 | currentPromptText = data.display_prompt || ""; |
| 117 | |
| 118 | overlay.classList.remove("hidden"); |
| 119 | modal.classList.remove("hidden"); |
| 120 | |
| 121 | await loadMonaco(); |
| 122 | createEditors(); |
| 123 | |
| 124 | copyBtn.onclick = async () => { |
| 125 | try { |
| 126 | await navigator.clipboard.writeText(currentPromptText); |
| 127 | copyBtn.textContent = "Copied"; |
| 128 | setTimeout(() => (copyBtn.textContent = "Copy"), 900); |
| 129 | } catch (e) { |
| 130 | alert("Copy failed: " + e.message); |
| 131 | } |
| 132 | }; |
| 133 | |
| 134 | setTimeout(() => { answerEditor && answerEditor.focus(); }, 0); |
| 135 | } |
| 136 | |
| 137 | function closeModal() { |
| 138 | disposeEditors(); |
no test coverage detected