MCPcopy Create free account
hub / github.com/SplootCode/splootcode / render

Method render

packages/editor/src/components/edit_box.tsx:38–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36 }
37
38 render() {
39 const { userInput } = this.state
40 const { editorX, editorY, editBoxData, selection } = this.props
41 const { x, y } = editBoxData
42
43 const hidden = selection.isHidden
44 const positionStyles: React.CSSProperties = {
45 position: 'absolute',
46 left: x + editorX - 1 + 'px',
47 top: y + editorY + 'px',
48 opacity: hidden ? 0 : 1,
49 }
50
51 if (editBoxData.node.layout.boxType === NodeBoxType.STRING) {
52 return (
53 <div style={positionStyles}>
54 <div className="edit-box edit-box-string">
55 <textarea
56 ref={this.editTextArea}
57 autoFocus
58 defaultValue={userInput}
59 onChange={this.onChange}
60 onKeyDown={this.onKeyDown}
61 />
62 </div>
63 </div>
64 )
65 }
66
67 return (
68 <div style={positionStyles}>
69 <div className="edit-box">
70 <input
71 ref={this.inputBox}
72 autoFocus
73 type="text"
74 value={userInput}
75 onChange={this.onChange}
76 onKeyDown={this.onKeyDown}
77 />
78 </div>
79 </div>
80 )
81 }
82
83 onKeyDown = (e: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {
84 const { selection } = this.props

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected