@ -11,9 +11,11 @@ class StatusContent extends React.PureComponent {
constructor ( props , context ) {
super ( props , context ) ;
this . state = {
hidden : true
} ;
this . onMentionClick = this . onMentionClick . bind ( this ) ;
this . onHashtagClick = this . onHashtagClick . bind ( this ) ;
this . handleMouseDown = this . handleMouseDown . bind ( this )
@ -36,8 +38,6 @@ class StatusContent extends React.PureComponent {
link . setAttribute ( 'title' , mention . get ( 'acct' ) ) ;
} else if ( link . textContent [ 0 ] === '#' || ( link . previousSibling && link . previousSibling . textContent && link . previousSibling . textContent [ link . previousSibling . textContent . length - 1 ] === '#' ) ) {
link . addEventListener ( 'click' , this . onHashtagClick . bind ( this , link . text ) , false ) ;
} else if ( media ) {
link . innerHTML = '<i class="fa fa-fw fa-photo"></i>' ;
} else {
link . setAttribute ( 'target' , '_blank' ) ;
link . setAttribute ( 'rel' , 'noopener' ) ;
@ -70,11 +70,11 @@ class StatusContent extends React.PureComponent {
const [ startX , startY ] = this . startXY ;
const [ deltaX , deltaY ] = [ Math . abs ( e . clientX - startX ) , Math . abs ( e . clientY - startY ) ] ;
if ( e . target . localName === 'a' || ( e . target . parentNode && e . target . parentNode . localName === 'a' ) ) {
if ( e . target . localName === 'button' || e . target . localName === ' a' || ( e . target . parentNode && e . target . parentNode . localName === 'a' ) ) {
return ;
}
if ( deltaX + deltaY < 5 && e . button === 0 ) {
if ( deltaX + deltaY < 5 && e . button === 0 && this . props . onClick ) {
this . props . onClick ( ) ;
}
@ -95,7 +95,7 @@ class StatusContent extends React.PureComponent {
const { hidden } = this . state ;
const content = { _ _html : emojify ( status . get ( 'content' ) ) } ;
const spoilerContent = { _ _html : emojify ( escapeTextContentForBrowser ( status . get ( 'spoiler_text' , '' ) ) ) } ;
const spoilerContent = { _ _html : emojify ( status . get ( 'spoiler_text' , '' ) ) } ;
const directionStyle = { direction : 'ltr' } ;
if ( isRtl ( status . get ( 'content' ) ) ) {
@ -118,14 +118,19 @@ class StatusContent extends React.PureComponent {
}
return (
< div className = 'status__content' onMouseDown = { this . handleMouseDown } onMouseUp = { this . handleMouseUp } >
< div
ref = { this . setRef }
className = 'status__content'
onMouseDown = { this . handleMouseDown }
onMouseUp = { this . handleMouseUp }
>
< p style = { { marginBottom : hidden && status . get ( 'mentions' ) . size === 0 ? '0px' : '' } } >
< span dangerouslySetInnerHTML = { spoilerContent } / > < a tabIndex = '0' className = 'status__content__spoiler-link' role = 'button' onClick = { this . handleSpoilerClick } > { toggleText } < / a >
< span dangerouslySetInnerHTML = { spoilerContent } / > < button tabIndex = '0' className = 'status__content__spoiler-link' onClick = { this . handleSpoilerClick } > { toggleText } < / b u t t o n >
< / p >
{ mentionsPlaceholder }
< div ref = { this . setRef } style = { { display : hidden ? 'none' : 'block' , ... directionStyle } } dangerouslySetInnerHTML = { content } / >
< div style = { { display : hidden ? 'none' : 'block' , ... directionStyle } } dangerouslySetInnerHTML = { content } / >
< / d i v >
) ;
} else if ( this . props . onClick ) {