()
| 60 | }; |
| 61 | |
| 62 | function commitText(): void { |
| 63 | if (!activeInput || !clickPos) return; |
| 64 | const content = activeInput.value.trim(); |
| 65 | activeInput.remove(); |
| 66 | activeInput = null; |
| 67 | |
| 68 | if (!content) return; |
| 69 | |
| 70 | const opts = getToolOptions(); |
| 71 | const id = crypto.randomUUID(); |
| 72 | addTextAnnotation(id, clickPos.pageX, clickPos.pageY, content, opts.fontSize, opts.textColor); |
| 73 | addAnnotation({ |
| 74 | type: "text", |
| 75 | id, |
| 76 | position: clickPos, |
| 77 | content, |
| 78 | fontSize: opts.fontSize, |
| 79 | color: opts.textColor, |
| 80 | targetComponent: targetComp, |
| 81 | }); |
| 82 | |
| 83 | clickPos = null; |
| 84 | targetComp = null; |
| 85 | } |
| 86 | |
| 87 | function cancelText(): void { |
| 88 | if (activeInput) { |
no test coverage detected