@ -11,9 +11,11 @@ class StatusContent extends React.PureComponent {
constructor ( props , context ) {
constructor ( props , context ) {
super ( props , context ) ;
super ( props , context ) ;
this . state = {
this . state = {
hidden : true
hidden : true
} ;
} ;
this . onMentionClick = this . onMentionClick . bind ( this ) ;
this . onMentionClick = this . onMentionClick . bind ( this ) ;
this . onHashtagClick = this . onHashtagClick . bind ( this ) ;
this . onHashtagClick = this . onHashtagClick . bind ( this ) ;
this . handleMouseDown = this . handleMouseDown . bind ( this )
this . handleMouseDown = this . handleMouseDown . bind ( this )
@ -36,8 +38,6 @@ class StatusContent extends React.PureComponent {
link . setAttribute ( 'title' , mention . get ( 'acct' ) ) ;
link . setAttribute ( 'title' , mention . get ( 'acct' ) ) ;
} else if ( link . textContent [ 0 ] === '#' || ( link . previousSibling && link . previousSibling . textContent && link . previousSibling . textContent [ link . previousSibling . textContent . length - 1 ] === '#' ) ) {
} 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 ) ;
link . addEventListener ( 'click' , this . onHashtagClick . bind ( this , link . text ) , false ) ;
} else if ( media ) {
link . innerHTML = '<i class="fa fa-fw fa-photo"></i>' ;
} else {
} else {
link . setAttribute ( 'target' , '_blank' ) ;
link . setAttribute ( 'target' , '_blank' ) ;
link . setAttribute ( 'rel' , 'noopener' ) ;
link . setAttribute ( 'rel' , 'noopener' ) ;
@ -70,11 +70,11 @@ class StatusContent extends React.PureComponent {
const [ startX , startY ] = this . startXY ;
const [ startX , startY ] = this . startXY ;
const [ deltaX , deltaY ] = [ Math . abs ( e . clientX - startX ) , Math . abs ( e . clientY - startY ) ] ;
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 ;
return ;
}
}
if ( deltaX + deltaY < 5 && e . button === 0 ) {
if ( deltaX + deltaY < 5 && e . button === 0 && this . props . onClick ) {
this . props . onClick ( ) ;
this . props . onClick ( ) ;
}
}
@ -95,7 +95,7 @@ class StatusContent extends React.PureComponent {
const { hidden } = this . state ;
const { hidden } = this . state ;
const content = { _ _html : emojify ( status . get ( 'content' ) ) } ;
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' } ;
const directionStyle = { direction : 'ltr' } ;
if ( isRtl ( status . get ( 'content' ) ) ) {
if ( isRtl ( status . get ( 'content' ) ) ) {
@ -118,14 +118,19 @@ class StatusContent extends React.PureComponent {
}
}
return (
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' : '' } } >
< 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 } < / bu t t o n >
< / p >
< / p >
{ mentionsPlaceholder }
{ 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 >
< / d i v >
) ;
) ;
} else if ( this . props . onClick ) {
} else if ( this . props . onClick ) {