@@ -5,7 +5,13 @@ const { styled } = require("styletron-react");
5
5
const TextPlane = require ( "./text_plane" ) ;
6
6
const $ = React . createElement ;
7
7
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 {
9
15
constructor ( props ) {
10
16
super ( props ) ;
11
17
this . onWheel = this . onWheel . bind ( this ) ;
@@ -56,39 +62,29 @@ class TextEditorContainer extends React.Component {
56
62
}
57
63
58
64
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
+ ) ;
69
79
}
70
80
71
81
onWheel ( event ) {
72
82
this . props . dispatch ( { type : 'UpdateScrollTop' , delta : event . deltaY } ) ;
73
83
}
74
84
}
75
85
76
- TextEditorContainer . contextTypes = {
86
+ TextEditor . contextTypes = {
77
87
theme : PropTypes . object
78
88
} ;
79
89
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