Added emoji wrapper with cross platform available gliffs

Этот коммит содержится в:
nickago
2015-08-28 08:50:52 -07:00
родитель 246a481abc
Коммит c81efd1391
6 изменённых файлов: 40 добавлений и 12 удалений

Просмотреть файл

@@ -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});