The most important feature
This commit is contained in:
parent
0a09326581
commit
3a16c8a764
3 changed files with 22 additions and 5 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ var SenderProfile = require('../molecules/SenderProfile');
|
|||
var UnknownMessageTile = require('../molecules/UnknownMessageTile');
|
||||
|
||||
var tileTypes = {
|
||||
'm.text': require('../molecules/MTextTile')
|
||||
'm.text': require('../molecules/MTextTile'),
|
||||
'm.emote': require('../molecules/MEmoteTile')
|
||||
};
|
||||
|
||||
module.exports = React.createClass({
|
||||
|
|
|
@ -4,6 +4,11 @@ module.exports = React.createClass({
|
|||
render: function() {
|
||||
var mxEvent = this.props.mxEvent;
|
||||
var name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
||||
|
||||
var msgtype = mxEvent.getContent().msgtype;
|
||||
if (msgtype && msgtype == 'm.emote') {
|
||||
name = ''; // emote message must include the name so don't duplicate it
|
||||
}
|
||||
return (
|
||||
<span className="mx_SenderProfile">
|
||||
{name}
|
||||
|
|
Loading…
Reference in a new issue