blob: 6d3a109c2cc5932c4732c726c74318165fafc7a2 (
plain)
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
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import * as TextFormatting from '../utils/text_formatting.jsx';
import UserStore from '../stores/user_store.jsx';
export default class Docs extends React.Component {
constructor(props) {
super(props);
UserStore.setCurrentUser(global.window.mm_user || {});
this.state = {text: ''};
const errorState = {text: '## 404'};
if (props.site) {
$.get(`/static/help/${props.site}_${global.window.mm_locale}.md`).then((response) => {
this.setState({text: response});
}, () => {
this.setState(errorState);
});
} else {
this.setState(errorState);
}
}
render() {
return (
<div
dangerouslySetInnerHTML={{__html: TextFormatting.formatText(this.state.text)}}
>
</div>
);
}
}
Docs.defaultProps = {
site: ''
};
Docs.propTypes = {
site: React.PropTypes.string
};
|