MCPcopy
hub / github.com/stemdeckapp/stemdeck / _openRename

Function _openRename

static/js/sections.js:289–314  ·  view source on GitHub ↗
(id, labelEl)

Source from the content-addressed store, hash-verified

287}
288
289function _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

Callers 2

_makeSectionElFunction · 0.85
_addSectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected