MCPcopy Index your code
hub / github.com/SplootCode/splootcode / Editor

Class Editor

packages/editor/src/components/editor.tsx:37–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36@observer
37export class Editor extends React.Component<EditorProps, EditorState> {
38 private editorSvgRef: React.RefObject<SVGSVGElement>
39 private editorColumnRef: React.RefObject<HTMLDivElement>
40
41 state = {
42 visibleView: 'tray' as EditorSideMenuView,
43 }
44
45 constructor(props: EditorProps) {
46 super(props)
47 this.editorSvgRef = React.createRef()
48 this.editorColumnRef = React.createRef()
49 }
50
51 render() {
52 const { block, selection, banner } = this.props
53 let fileBody = null
54
55 fileBody = block.renderedChildSets['body']
56
57 const height = block.rowHeight + block.indentedBlockHeight
58 let insertBox = null
59 let editBox = null
60 if (selection.isCursor() && selection.insertBox !== null) {
61 insertBox = (
62 <InsertBox
63 hidden={selection.isHidden}
64 editorX={0}
65 editorY={0}
66 selection={selection}
67 cursorPosition={selection.cursor}
68 insertBoxData={selection.insertBox}
69 />
70 )
71 } else if (selection.isEditingSingleNode()) {
72 editBox = <EditBox editorX={1} editorY={1} selection={selection} editBoxData={selection.editBox} />
73 }
74 return (
75 <React.Fragment>
76 <div className="editor-column">
77 {banner}
78 <div
79 className="editor-box"
80 ref={this.editorColumnRef}
81 onBlur={this.onBlurHandler}
82 onFocus={this.onFocusHandler}
83 >
84 <svg
85 className="editor-svg"
86 xmlns="http://www.w3.org/2000/svg"
87 height={height}
88 preserveAspectRatio="none"
89 onClick={this.onClickHandler}
90 ref={this.editorSvgRef}
91 >
92 <ExpandedListBlockView block={fileBody} isSelected={false} />
93 <ActiveCursor selection={selection} />
94 </svg>

Callers

nothing calls this directly

Calls 15

deserializeFragmentFunction · 0.90
onEditorBlurMethod · 0.80
onEditorFocusMethod · 0.80
copyCurrentSelectionMethod · 0.80
deleteSelectedNodeMethod · 0.80
insertFragmentMethod · 0.80
isSingleNodeMethod · 0.80
editSelectionLeftMethod · 0.80
editSelectionRightMethod · 0.80
moveCursorLeftMethod · 0.80
moveCursorRightMethod · 0.80

Tested by

no test coverage detected