The most important feature

This commit is contained in:
David Baker 2015-06-16 15:29:13 +01:00
parent 0a09326581
commit 3a16c8a764
3 changed files with 22 additions and 5 deletions

View file

@ -6,10 +6,21 @@ module.exports = React.createClass({
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
});
var content = null;
if (/^\/me /i.test(contentText)) {
content = {
msgtype: 'm.emote',
body: contentText.substring(4)
};
} else {
content = {
msgtype: 'm.text',
body: contentText
};
}
MatrixClientPeg.get().sendMessage(this.props.roomId, content);
this.refs.textarea.getDOMNode().value = '';
ev.preventDefault();
}