MCPcopy Create free account
hub / github.com/donghaxkim/react-rewrite / commitText

Function commitText

packages/overlay/src/tools/text.ts:62–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60};
61
62function 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
87function cancelText(): void {
88 if (activeInput) {

Callers 1

onMouseDownFunction · 0.85

Calls 3

getToolOptionsFunction · 0.85
addTextAnnotationFunction · 0.85
addAnnotationFunction · 0.85

Tested by

no test coverage detected