From 88e9ab02f95583acdcebf41467214bdb6e74b679 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 16 Jun 2015 11:08:27 +0100 Subject: [PATCH] Yay, message sending. --- src/molecules/MessageComposer.js | 16 +++++++++++++--- src/organisms/RoomView.js | 10 +++++----- src/pages/MatrixChat.js | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/molecules/MessageComposer.js b/src/molecules/MessageComposer.js index 0782797d..f3a554ff 100644 --- a/src/molecules/MessageComposer.js +++ b/src/molecules/MessageComposer.js @@ -3,12 +3,22 @@ var React = require('react'); var MatrixClientPeg = require("../MatrixClientPeg"); 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 + }); + this.refs.textarea.getDOMNode().value = ''; + ev.preventDefault(); + } + }, + render: function() { return (
-
-