(name: string, val: string)
| 538 | } |
| 539 | |
| 540 | function attrRow(name: string, val: string): HTMLDivElement { |
| 541 | const row = document.createElement("div"); |
| 542 | row.className = "prop-row"; |
| 543 | const lbl = propLabel(name); |
| 544 | lbl.style.maxWidth = "80px"; |
| 545 | lbl.style.overflow = "hidden"; |
| 546 | lbl.style.textOverflow = "ellipsis"; |
| 547 | const inp = document.createElement("input"); |
| 548 | inp.type = "text"; |
| 549 | inp.className = "prop-input"; |
| 550 | inp.style.flex = "1"; |
| 551 | inp.value = val; |
| 552 | inp.addEventListener("blur", () => commitAttr(name, inp.value)); |
| 553 | inp.addEventListener("keydown", (e) => { |
| 554 | if (e.key === "Enter") inp.blur(); |
| 555 | }); |
| 556 | row.appendChild(lbl); |
| 557 | row.appendChild(inp); |
| 558 | return row; |
| 559 | } |
| 560 | |
| 561 | function commitAttr(name: string, raw: string) { |
| 562 | if (!comp || !selectedId) return; |
no test coverage detected