mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix void link for user address link
This commit is contained in:
@@ -3,7 +3,16 @@ import { Link } from "react-router-dom";
|
||||
|
||||
const ForwardRefLink = React.forwardRef((props, ref) => {
|
||||
const { children, setRefAndCid, onMouseOver, onMouseLeave, onClick, ...otherProps } = props;
|
||||
|
||||
|
||||
const handleClick = (event) => {
|
||||
if (otherProps.to === "#void") {
|
||||
event.preventDefault();
|
||||
}
|
||||
if (onClick) {
|
||||
onClick(event);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (ref.current && typeof setRefAndCid === 'function') {
|
||||
setRefAndCid(ref.current);
|
||||
@@ -16,7 +25,7 @@ const ForwardRefLink = React.forwardRef((props, ref) => {
|
||||
{...otherProps}
|
||||
onMouseOver={onMouseOver}
|
||||
onMouseLeave={onMouseLeave}
|
||||
onClick={onClick}
|
||||
onClick={handleClick}
|
||||
>
|
||||
{children}
|
||||
</Link>
|
||||
|
||||
@@ -74,7 +74,7 @@ const Post = ({ content, postQuoteOnClick, postQuoteOnOver, postQuoteOnLeave, po
|
||||
const linkTarget = matchedText.startsWith('u/') ? "_blank" : "_self";
|
||||
|
||||
if (matchedText.startsWith('u/')) {
|
||||
linkTo = () => {};
|
||||
linkTo = "#void";
|
||||
} else if (matchedText.startsWith('p/') || matchedText.startsWith('p/')) {
|
||||
linkTo = `/${matchedText}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user