HTML and Markdown emotes.

This commit is contained in:
Matthew Hodgson 2015-11-28 22:34:45 +00:00
parent 52376091cb
commit f028b343b0
2 changed files with 13 additions and 15 deletions

View file

@ -311,23 +311,21 @@ module.exports = React.createClass({
var isEmote = /^\/me /i.test(contentText);
var sendMessagePromise;
if (isEmote) {
sendMessagePromise = MatrixClientPeg.get().sendEmoteMessage(
this.props.room.roomId, contentText.substring(4)
);
contentText = contentText.substring(4);
}
var htmlText;
if (this.markdownEnabled) && (htmlText = mdownToHtml(contentText)) !== contentText) {
sendMessagePromise = isEmote ?
MatrixClientPeg.get().sendHtmlEmote(this.props.room.roomId, contentText, htmlText) :
MatrixClientPeg.get().sendHtmlMessage(this.props.room.roomId, contentText, htmlText);
}
else {
var htmlText = mdownToHtml(contentText);
if (this.markdownEnabled && htmlText !== contentText) {
sendMessagePromise = MatrixClientPeg.get().sendHtmlMessage(
this.props.room.roomId, contentText, htmlText
);
}
else {
sendMessagePromise = MatrixClientPeg.get().sendTextMessage(
this.props.room.roomId, contentText
);
}
sendMessagePromise = isEmote ?
MatrixClientPeg.get().sendEmoteMessage(this.props.room.roomId, contentText) :
MatrixClientPeg.get().sendTextMessage(this.props.room.roomId, contentText);
}
sendMessagePromise.then(function() {

View file

@ -56,7 +56,7 @@ module.exports = React.createClass({
var name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
return (
<span ref="content" className="mx_MEmoteTile mx_MessageTile_content">
* {name} {content.body}
* { name } { body }
</span>
);
case "m.notice":