Prevent clicking stuff in statuses from expanding the status
This commit is contained in:
parent
1fb8d162db
commit
bf8de20e0d
|
@ -87,6 +87,7 @@ const StatusContent: React.FC<IStatusContent> = ({ status, expanded = false, onE
|
|||
const onMentionClick = (mention: Mention, e: MouseEvent) => {
|
||||
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
history.push(`/@${mention.acct}`);
|
||||
}
|
||||
};
|
||||
|
@ -96,10 +97,16 @@ const StatusContent: React.FC<IStatusContent> = ({ status, expanded = false, onE
|
|||
|
||||
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
history.push(`/tags/${hashtag}`);
|
||||
}
|
||||
};
|
||||
|
||||
/** For regular links, just stop propogation */
|
||||
const onLinkClick = (e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
const updateStatusLinks = () => {
|
||||
if (!node.current) return;
|
||||
|
||||
|
@ -124,6 +131,7 @@ const StatusContent: React.FC<IStatusContent> = ({ status, expanded = false, onE
|
|||
link.addEventListener('click', onHashtagClick.bind(link, link.text), false);
|
||||
} else {
|
||||
link.setAttribute('title', link.href);
|
||||
link.addEventListener('click', onLinkClick.bind(link), false);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -252,7 +252,14 @@ export default class Card extends React.PureComponent {
|
|||
}
|
||||
|
||||
return (
|
||||
<a href={card.get('url')} className={className} target='_blank' rel='noopener' ref={this.setRef}>
|
||||
<a
|
||||
href={card.get('url')}
|
||||
className={className}
|
||||
target='_blank'
|
||||
rel='noopener'
|
||||
ref={this.setRef}
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
{embed}
|
||||
{description}
|
||||
</a>
|
||||
|
|
Loading…
Reference in New Issue