mirror of
https://github.com/mastodon/mastodon.git
synced 2025-10-05 16:42:47 +00:00
fix: Attempt to fix new tab on scroll, #34696
This commit is contained in:
parent
3f965d83b0
commit
dfc887d1ba
|
@ -1,3 +1,5 @@
|
||||||
|
import { createRef } from 'react';
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
|
import { injectIntl, defineMessages, FormattedMessage } from 'react-intl';
|
||||||
|
@ -175,13 +177,24 @@ class Status extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
handleMouseUp = e => {
|
wasClickStartedWithinStatusInfo = createRef(false);
|
||||||
// Only handle clicks on the empty space above the content
|
|
||||||
|
|
||||||
if (e.target !== e.currentTarget && e.detail >= 1) {
|
handleMouseDown = e => {
|
||||||
|
this.wasClickStartedWithinStatusInfo.current = e.currentTarget === e.target ||
|
||||||
|
e.currentTarget.contains(e.target);
|
||||||
|
};
|
||||||
|
|
||||||
|
handleMouseUp = e => {
|
||||||
|
const wasClickStartedWithin = this.wasClickStartedWithinStatusInfo.current;
|
||||||
|
this.wasClickStartedWithinStatusInfo.current = false;
|
||||||
|
|
||||||
|
console.log('up', wasClickStartedWithin)
|
||||||
|
|
||||||
|
// Only handle clicks on the empty space above the content,
|
||||||
|
// bail out if the click was initialised outside
|
||||||
|
if (!wasClickStartedWithin || e.detail > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handleClick(e);
|
this.handleClick(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -547,7 +560,7 @@ class Status extends ImmutablePureComponent {
|
||||||
<div className={classNames('status', `status-${status.get('visibility')}`, { 'status-reply': !!status.get('in_reply_to_id'), 'status--in-thread': !!rootId, 'status--first-in-thread': previousId && (!connectUp || connectToRoot), muted: this.props.muted })} data-id={status.get('id')}>
|
<div className={classNames('status', `status-${status.get('visibility')}`, { 'status-reply': !!status.get('in_reply_to_id'), 'status--in-thread': !!rootId, 'status--first-in-thread': previousId && (!connectUp || connectToRoot), muted: this.props.muted })} data-id={status.get('id')}>
|
||||||
{(connectReply || connectUp || connectToRoot) && <div className={classNames('status__line', { 'status__line--full': connectReply, 'status__line--first': !status.get('in_reply_to_id') && !connectToRoot })} />}
|
{(connectReply || connectUp || connectToRoot) && <div className={classNames('status__line', { 'status__line--full': connectReply, 'status__line--first': !status.get('in_reply_to_id') && !connectToRoot })} />}
|
||||||
|
|
||||||
<div onMouseUp={this.handleMouseUp} className='status__info'>
|
<div onMouseUp={this.handleMouseUp} onMouseDown={this.handleMouseDown} className='status__info'>
|
||||||
<Link to={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`} className='status__relative-time'>
|
<Link to={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`} className='status__relative-time'>
|
||||||
<span className='status__visibility-icon'><VisibilityIcon visibility={status.get('visibility')} /></span>
|
<span className='status__visibility-icon'><VisibilityIcon visibility={status.get('visibility')} /></span>
|
||||||
<RelativeTimestamp timestamp={status.get('created_at')} />{status.get('edited_at') && <abbr title={intl.formatMessage(messages.edited, { date: intl.formatDate(status.get('edited_at'), { year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) })}> *</abbr>}
|
<RelativeTimestamp timestamp={status.get('created_at')} />{status.get('edited_at') && <abbr title={intl.formatMessage(messages.edited, { date: intl.formatDate(status.get('edited_at'), { year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) })}> *</abbr>}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user