1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

Add EmojiText component for emoji replacement.

This commit is contained in:
Aviral Dasgupta
2016-08-10 00:31:51 +05:30
parent dbbea63227
commit 09e8a45cde
10 changed files with 59 additions and 38 deletions

View File

@ -23,7 +23,7 @@ var linkify = require('linkifyjs');
var linkifyElement = require('linkifyjs/element');
var linkifyMatrix = require('../../../linkify-matrix');
var sdk = require('../../../index');
import {emojifyText} from '../../../HtmlUtils';
import EmojiText from '../../views/elements/EmojiText';
linkifyMatrix(linkify);
@ -202,10 +202,9 @@ module.exports = React.createClass({
switch (content.msgtype) {
case "m.emote":
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
const nameHtml = emojifyText(name);
return (
<span ref="content" className="mx_MEmoteBody mx_EventTile_content">
* <span dangerouslySetInnerHTML={nameHtml} /> { body }
* <EmojiText>{name}</EmojiText> { body }
{ widgets }
</span>
);