|
|
@ -75,35 +75,38 @@ export default class StatusContent extends React.PureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_updateStatusEmojis () {
|
|
|
|
handleMouseEnter = ({ currentTarget }) => {
|
|
|
|
const node = this.node;
|
|
|
|
if (autoPlayGif) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!node || autoPlayGif) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const emojis = node.querySelectorAll('.custom-emoji');
|
|
|
|
const emojis = currentTarget.querySelectorAll('.custom-emoji');
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < emojis.length; i++) {
|
|
|
|
for (var i = 0; i < emojis.length; i++) {
|
|
|
|
let emoji = emojis[i];
|
|
|
|
let emoji = emojis[i];
|
|
|
|
if (emoji.classList.contains('status-emoji')) {
|
|
|
|
emoji.src = emoji.getAttribute('data-original');
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
emoji.classList.add('status-emoji');
|
|
|
|
|
|
|
|
|
|
|
|
handleMouseLeave = ({ currentTarget }) => {
|
|
|
|
|
|
|
|
if (autoPlayGif) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const emojis = currentTarget.querySelectorAll('.custom-emoji');
|
|
|
|
|
|
|
|
|
|
|
|
emoji.addEventListener('mouseenter', this.handleEmojiMouseEnter, false);
|
|
|
|
for (var i = 0; i < emojis.length; i++) {
|
|
|
|
emoji.addEventListener('mouseleave', this.handleEmojiMouseLeave, false);
|
|
|
|
let emoji = emojis[i];
|
|
|
|
|
|
|
|
emoji.src = emoji.getAttribute('data-static');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount () {
|
|
|
|
componentDidMount () {
|
|
|
|
this._updateStatusLinks();
|
|
|
|
this._updateStatusLinks();
|
|
|
|
this._updateStatusEmojis();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate () {
|
|
|
|
componentDidUpdate () {
|
|
|
|
this._updateStatusLinks();
|
|
|
|
this._updateStatusLinks();
|
|
|
|
this._updateStatusEmojis();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMentionClick = (mention, e) => {
|
|
|
|
onMentionClick = (mention, e) => {
|
|
|
@ -122,14 +125,6 @@ export default class StatusContent extends React.PureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleEmojiMouseEnter = ({ target }) => {
|
|
|
|
|
|
|
|
target.src = target.getAttribute('data-original');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleEmojiMouseLeave = ({ target }) => {
|
|
|
|
|
|
|
|
target.src = target.getAttribute('data-static');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleMouseDown = (e) => {
|
|
|
|
handleMouseDown = (e) => {
|
|
|
|
this.startXY = [e.clientX, e.clientY];
|
|
|
|
this.startXY = [e.clientX, e.clientY];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -219,7 +214,7 @@ export default class StatusContent extends React.PureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={classNames} ref={this.setRef} tabIndex='0' onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}>
|
|
|
|
<div className={classNames} ref={this.setRef} tabIndex='0' onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
|
|
|
<p style={{ marginBottom: hidden && status.get('mentions').isEmpty() ? '0px' : null }}>
|
|
|
|
<p style={{ marginBottom: hidden && status.get('mentions').isEmpty() ? '0px' : null }}>
|
|
|
|
<span dangerouslySetInnerHTML={spoilerContent} className='translate' />
|
|
|
|
<span dangerouslySetInnerHTML={spoilerContent} className='translate' />
|
|
|
|
{' '}
|
|
|
|
{' '}
|
|
|
@ -237,7 +232,7 @@ export default class StatusContent extends React.PureComponent {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else if (this.props.onClick) {
|
|
|
|
} else if (this.props.onClick) {
|
|
|
|
const output = [
|
|
|
|
const output = [
|
|
|
|
<div className={classNames} ref={this.setRef} tabIndex='0' onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp} key='status-content'>
|
|
|
|
<div className={classNames} ref={this.setRef} tabIndex='0' onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp} key='status-content' onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
|
|
|
<div className='status__content__text status__content__text--visible translate' dangerouslySetInnerHTML={content} />
|
|
|
|
<div className='status__content__text status__content__text--visible translate' dangerouslySetInnerHTML={content} />
|
|
|
|
|
|
|
|
|
|
|
|
{!!status.get('poll') && <PollContainer pollId={status.get('poll')} />}
|
|
|
|
{!!status.get('poll') && <PollContainer pollId={status.get('poll')} />}
|
|
|
@ -253,7 +248,7 @@ export default class StatusContent extends React.PureComponent {
|
|
|
|
return output;
|
|
|
|
return output;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={classNames} ref={this.setRef} tabIndex='0'>
|
|
|
|
<div className={classNames} ref={this.setRef} tabIndex='0' onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
|
|
|
<div className='status__content__text status__content__text--visible translate' dangerouslySetInnerHTML={content} />
|
|
|
|
<div className='status__content__text status__content__text--visible translate' dangerouslySetInnerHTML={content} />
|
|
|
|
|
|
|
|
|
|
|
|
{!!status.get('poll') && <PollContainer pollId={status.get('poll')} />}
|
|
|
|
{!!status.get('poll') && <PollContainer pollId={status.get('poll')} />}
|
|
|
|