Skip to content
This repository was archived by the owner on Jul 23, 2019. It is now read-only.

Commit c75db56

Browse files
committed
Remove extra TextEditor stateless component
1 parent 099bed2 commit c75db56

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

xray_electron/lib/render_process/text_editor/text_editor.js

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ const { styled } = require("styletron-react");
55
const TextPlane = require("./text_plane");
66
const $ = React.createElement;
77

8-
class TextEditorContainer extends React.Component {
8+
const Root = styled("div", {
9+
width: "100%",
10+
height: "100%",
11+
overflow: "hidden"
12+
});
13+
14+
class TextEditor extends React.Component {
915
constructor(props) {
1016
super(props);
1117
this.onWheel = this.onWheel.bind(this);
@@ -56,39 +62,29 @@ class TextEditorContainer extends React.Component {
5662
}
5763

5864
render() {
59-
return $(TextEditor, {
60-
showCursors: this.state.showCursors,
61-
lineHeight: this.props.line_height,
62-
scrollTop: this.props.scroll_top,
63-
height: this.props.height,
64-
width: this.props.width,
65-
selections: this.props.selections,
66-
firstVisibleRow: this.props.first_visible_row,
67-
lines: this.props.lines
68-
});
65+
return $(
66+
Root,
67+
{},
68+
$(TextPlane, {
69+
showCursors: this.state.showCursors,
70+
lineHeight: this.props.line_height,
71+
scrollTop: this.props.scroll_top,
72+
height: this.props.height,
73+
width: this.props.width,
74+
selections: this.props.selections,
75+
firstVisibleRow: this.props.first_visible_row,
76+
lines: this.props.lines
77+
})
78+
);
6979
}
7080

7181
onWheel (event) {
7282
this.props.dispatch({type: 'UpdateScrollTop', delta: event.deltaY});
7383
}
7484
}
7585

76-
TextEditorContainer.contextTypes = {
86+
TextEditor.contextTypes = {
7787
theme: PropTypes.object
7888
};
7989

80-
const Root = styled("div", {
81-
width: "100%",
82-
height: "100%",
83-
overflow: "hidden"
84-
});
85-
86-
function TextEditor(props) {
87-
return $(
88-
Root,
89-
{onWheel: props.onWheel},
90-
$(TextPlane, props)
91-
);
92-
}
93-
94-
module.exports = TextEditorContainer;
90+
module.exports = TextEditor;

0 commit comments

Comments
 (0)