Markdown: Split up render function into toHTML/toPlaintext

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
This commit is contained in:
Johannes Löthberg 2017-01-18 19:29:11 +01:00
parent 6d2e521421
commit 30bd01cdf2
3 changed files with 61 additions and 47 deletions

View file

@ -325,13 +325,13 @@ module.exports = React.createClass({
}
if (send_markdown) {
const htmlText = mdown.render(true);
const htmlText = mdown.toHTML();
sendMessagePromise = isEmote ?
MatrixClientPeg.get().sendHtmlEmote(this.props.room.roomId, contentText, htmlText) :
MatrixClientPeg.get().sendHtmlMessage(this.props.room.roomId, contentText, htmlText);
}
else {
const contentText = mdown.render(false);
const contentText = mdown.toPlaintext(false);
sendMessagePromise = isEmote ?
MatrixClientPeg.get().sendEmoteMessage(this.props.room.roomId, contentText) :
MatrixClientPeg.get().sendTextMessage(this.props.room.roomId, contentText);