mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:16:08 +03:00
HTML and Markdown emotes.
This commit is contained in:
parent
52376091cb
commit
f028b343b0
2 changed files with 13 additions and 15 deletions
|
@ -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() {
|
||||
|
|
|
@ -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":
|
||||
|
|
Loading…
Reference in a new issue