From c81efd139199f9105178bd52623f887187d49b64 Mon Sep 17 00:00:00 2001 From: nickago Date: Fri, 28 Aug 2015 08:50:52 -0700 Subject: Added emoji wrapper with cross platform available gliffs --- web/react/components/post_body.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'web/react/components/post_body.jsx') diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx index 88fb9aec8..d9b8f20ce 100644 --- a/web/react/components/post_body.jsx +++ b/web/react/components/post_body.jsx @@ -5,14 +5,26 @@ const FileAttachmentList = require('./file_attachment_list.jsx'); const UserStore = require('../stores/user_store.jsx'); const Utils = require('../utils/utils.jsx'); const Constants = require('../utils/constants.jsx'); +const twemoji = require('twemoji'); export default class PostBody extends React.Component { constructor(props) { super(props); + this.parseEmojis = this.parseEmojis.bind(this); + const linkData = Utils.extractLinks(this.props.post.message); this.state = {links: linkData.links, message: linkData.text}; } + parseEmojis() { + twemoji.parse(React.findDOMNode(this), {size: Constants.EMOJI_SIZE}); + } + componentDidMount() { + this.parseEmojis(); + } + componentDidUpdate() { + this.parseEmojis(); + } componentWillReceiveProps(nextProps) { const linkData = Utils.extractLinks(nextProps.post.message); this.setState({links: linkData.links, message: linkData.text}); -- cgit v1.2.3-1-g7c22