Changed one instance of textToJsx to use new text formatting for testing purposes

Этот коммит содержится в:
hmhealey
2015-09-10 11:06:08 -04:00
родитель 91f258c725
Коммит 56312f8f53

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

@@ -5,6 +5,7 @@ const FileAttachmentList = require('./file_attachment_list.jsx');
const UserStore = require('../stores/user_store.jsx'); const UserStore = require('../stores/user_store.jsx');
const Utils = require('../utils/utils.jsx'); const Utils = require('../utils/utils.jsx');
const Constants = require('../utils/constants.jsx'); const Constants = require('../utils/constants.jsx');
const TextFormatting = require('../utils/text_formatting.jsx');
const twemoji = require('twemoji'); const twemoji = require('twemoji');
export default class PostBody extends React.Component { export default class PostBody extends React.Component {
@@ -12,6 +13,7 @@ export default class PostBody extends React.Component {
super(props); super(props);
this.parseEmojis = this.parseEmojis.bind(this); this.parseEmojis = this.parseEmojis.bind(this);
this.handleClick = this.handleClick.bind(this);
const linkData = Utils.extractLinks(this.props.post.message); const linkData = Utils.extractLinks(this.props.post.message);
this.state = {links: linkData.links, message: linkData.text}; this.state = {links: linkData.links, message: linkData.text};
@@ -29,6 +31,12 @@ export default class PostBody extends React.Component {
const linkData = Utils.extractLinks(nextProps.post.message); const linkData = Utils.extractLinks(nextProps.post.message);
this.setState({links: linkData.links, message: linkData.text}); this.setState({links: linkData.links, message: linkData.text});
} }
handleClick(e) {
let mentionAttribute = e.target.getAttributeNode('data-mention');
if (mentionAttribute) {
Utils.searchForTerm(mentionAttribute.value);
}
}
render() { render() {
const post = this.props.post; const post = this.props.post;
const filenames = this.props.post.filenames; const filenames = this.props.post.filenames;
@@ -135,7 +143,7 @@ export default class PostBody extends React.Component {
key={`${post.id}_message`} key={`${post.id}_message`}
className={postClass} className={postClass}
> >
{loading}<span>{inner}</span> {loading}<span onClick={this.handleClick} dangerouslySetInnerHTML={{__html: TextFormatting.formatText(this.state.message)}}/>
</p> </p>
{fileAttachmentHolder} {fileAttachmentHolder}
{embed} {embed}