import PureRenderMixin from 'react-addons-pure-render-mixin';
import emojify from '../emoji';
-const hideContent = str => $('<p>').html(str).text().replace(/[^\s]/g, '█');
-
const StatusContent = React.createClass({
contextTypes: {
onClick: React.PropTypes.func
},
- // getInitialState () {
- // return {
- // visible: false
- // };
- // },
-
mixins: [PureRenderMixin],
componentDidMount () {
render () {
const { status, onClick } = this.props;
- const hidden = false; // (status.get('sensitive') && !this.state.visible);
- const content = { __html: hidden ? hideContent(status.get('content')) : emojify(status.get('content')) };
+ const content = { __html: emojify(status.get('content')) };
- return <div className='status__content' style={{ cursor: 'pointer', color: hidden ? '#616b86' : null }} dangerouslySetInnerHTML={content} onClick={onClick} />;
+ return <div className='status__content' style={{ cursor: 'pointer' }} dangerouslySetInnerHTML={content} onClick={onClick} />;
},
});
html = status.text
html = encode(html)
html = simple_format(html, sanitize: false)
+ html = html.gsub(/\n/, '')
html = link_urls(html)
html = link_mentions(html, status.mentions)
html = link_hashtags(html)
end
def link_urls(html)
- auto_link(html, link: :urls, html: { rel: 'nofollow noopener' }) do |text|
+ auto_link(html, link: :urls, html: { rel: 'nofollow noopener', target: '_blank' }) do |text|
truncate(text.gsub(/\Ahttps?:\/\/(www\.)?/, ''), length: 30)
end
end