mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 10:15:43 +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 isEmote = /^\/me /i.test(contentText);
|
||||||
var sendMessagePromise;
|
var sendMessagePromise;
|
||||||
|
|
||||||
if (isEmote) {
|
if (isEmote) {
|
||||||
sendMessagePromise = MatrixClientPeg.get().sendEmoteMessage(
|
contentText = contentText.substring(4);
|
||||||
this.props.room.roomId, 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 {
|
else {
|
||||||
var htmlText = mdownToHtml(contentText);
|
sendMessagePromise = isEmote ?
|
||||||
if (this.markdownEnabled && htmlText !== contentText) {
|
MatrixClientPeg.get().sendEmoteMessage(this.props.room.roomId, contentText) :
|
||||||
sendMessagePromise = MatrixClientPeg.get().sendHtmlMessage(
|
MatrixClientPeg.get().sendTextMessage(this.props.room.roomId, contentText);
|
||||||
this.props.room.roomId, contentText, htmlText
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sendMessagePromise = MatrixClientPeg.get().sendTextMessage(
|
|
||||||
this.props.room.roomId, contentText
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessagePromise.then(function() {
|
sendMessagePromise.then(function() {
|
||||||
|
|
|
@ -56,7 +56,7 @@ module.exports = React.createClass({
|
||||||
var name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
var name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
||||||
return (
|
return (
|
||||||
<span ref="content" className="mx_MEmoteTile mx_MessageTile_content">
|
<span ref="content" className="mx_MEmoteTile mx_MessageTile_content">
|
||||||
* {name} {content.body}
|
* { name } { body }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
case "m.notice":
|
case "m.notice":
|
||||||
|
|
Loading…
Reference in a new issue