(id, labelEl)
| 287 | } |
| 288 | |
| 289 | function _openRename(id, labelEl) { |
| 290 | if (!labelEl) return; |
| 291 | const section = _sections.find((s) => s.id === id); |
| 292 | if (!section) return; |
| 293 | |
| 294 | const input = document.createElement("input"); |
| 295 | input.className = "section-rename-input"; |
| 296 | input.type = "text"; |
| 297 | input.value = section.name; |
| 298 | input.style.setProperty("--sc", section.color); |
| 299 | labelEl.replaceWith(input); |
| 300 | input.focus(); |
| 301 | input.select(); |
| 302 | |
| 303 | const commit = () => { |
| 304 | const n = input.value.trim(); |
| 305 | if (n) section.name = n; |
| 306 | _render(); |
| 307 | _scheduleSave(); |
| 308 | }; |
| 309 | input.addEventListener("blur", commit, { once: true }); |
| 310 | input.addEventListener("keydown", (e) => { |
| 311 | if (e.key === "Enter") { e.preventDefault(); input.blur(); } |
| 312 | if (e.key === "Escape") { input.value = section.name; input.removeEventListener("blur", commit); input.blur(); } |
| 313 | }); |
| 314 | } |
| 315 | |
| 316 | // ─── Persistence ────────────────────────────────────────── |
| 317 |
no outgoing calls
no test coverage detected