-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.js
50 lines (43 loc) · 1000 Bytes
/
bootstrap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var App = App || {};
(function() {
'use strict';
var e = React.createElement
, Preview = App.Preview
, MarkdownEditor = App.MarkdownEditor;
var Bootstrap = React.createClass({
getInitialState: function() {
return {
value: '',
words: 0,
scrollTol: 0
}
},
render: function() {
return (
e('div', {className: 'app'},
e('form', null,
e('div', null,
e(MarkdownEditor, {
onChange: this.handleChange,
syncScroll: this.syncScroll
}),
e(Preview, this.state)
)
)
)
)
},
handleChange: function(value) {
this.setState({
value: value,
words: value && value.match(/\S+/g).length || 0
})
},
syncScroll: function(scrollTop) {
this.setState({
scrollTop: scrollTop
});
}
});
React.render(e(Bootstrap, null), document.body);
})();