2015-06-15 20:35:28 +03:00
|
|
|
var React = require('react');
|
|
|
|
|
|
|
|
var MatrixClientPeg = require("../MatrixClientPeg");
|
|
|
|
|
|
|
|
module.exports = React.createClass({
|
2015-06-16 13:08:27 +03:00
|
|
|
onKeyDown: function (ev) {
|
|
|
|
if (ev.keyCode == 13) {
|
|
|
|
var contentText = this.refs.textarea.getDOMNode().value;
|
|
|
|
MatrixClientPeg.get().sendMessage(this.props.roomId, {
|
|
|
|
msgtype: 'm.text',
|
|
|
|
body: contentText
|
|
|
|
});
|
|
|
|
this.refs.textarea.getDOMNode().value = '';
|
|
|
|
ev.preventDefault();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-06-15 20:35:28 +03:00
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
<div className="mx_MessageComposer">
|
2015-06-16 13:08:27 +03:00
|
|
|
<textarea ref="textarea" onKeyDown={this.onKeyDown} />
|
2015-06-15 20:35:28 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|