mirror of https://github.com/Siphonay/mastodon
Fix link handling within detailed status contents
This commit is contained in:
parent
4050beb6e2
commit
427ed60274
|
@ -19,6 +19,7 @@ import { getHashtagBarForStatus } from 'flavours/glitch/components/hashtag_bar';
|
||||||
import { IconLogo } from 'flavours/glitch/components/logo';
|
import { IconLogo } from 'flavours/glitch/components/logo';
|
||||||
import { Permalink } from 'flavours/glitch/components/permalink';
|
import { Permalink } from 'flavours/glitch/components/permalink';
|
||||||
import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder';
|
import PictureInPicturePlaceholder from 'flavours/glitch/components/picture_in_picture_placeholder';
|
||||||
|
import { useAppHistory } from 'flavours/glitch/components/router';
|
||||||
import { VisibilityIcon } from 'flavours/glitch/components/visibility_icon';
|
import { VisibilityIcon } from 'flavours/glitch/components/visibility_icon';
|
||||||
import { useAppSelector } from 'flavours/glitch/store';
|
import { useAppSelector } from 'flavours/glitch/store';
|
||||||
|
|
||||||
|
@ -71,6 +72,7 @@ export const DetailedStatus: React.FC<{
|
||||||
const properStatus = status?.get('reblog') ?? status;
|
const properStatus = status?.get('reblog') ?? status;
|
||||||
const [height, setHeight] = useState(0);
|
const [height, setHeight] = useState(0);
|
||||||
const nodeRef = useRef<HTMLDivElement>();
|
const nodeRef = useRef<HTMLDivElement>();
|
||||||
|
const history = useAppHistory();
|
||||||
|
|
||||||
const rewriteMentions = useAppSelector(
|
const rewriteMentions = useAppSelector(
|
||||||
(state) => state.local_settings.get('rewrite_mentions', false) as boolean,
|
(state) => state.local_settings.get('rewrite_mentions', false) as boolean,
|
||||||
|
@ -137,6 +139,18 @@ export const DetailedStatus: React.FC<{
|
||||||
if (onTranslate) onTranslate(status);
|
if (onTranslate) onTranslate(status);
|
||||||
}, [onTranslate, status]);
|
}, [onTranslate, status]);
|
||||||
|
|
||||||
|
const parseClick = useCallback(
|
||||||
|
(e: React.MouseEvent, destination: string) => {
|
||||||
|
if (e.button === 0 && !(e.ctrlKey || e.altKey || e.metaKey)) {
|
||||||
|
e.preventDefault();
|
||||||
|
history.push(destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
e.stopPropagation();
|
||||||
|
},
|
||||||
|
[history],
|
||||||
|
);
|
||||||
|
|
||||||
if (!properStatus) {
|
if (!properStatus) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -354,7 +368,6 @@ export const DetailedStatus: React.FC<{
|
||||||
)}
|
)}
|
||||||
</Permalink>
|
</Permalink>
|
||||||
|
|
||||||
{/* TODO: parseClick={this.parseClick} */}
|
|
||||||
<StatusContent
|
<StatusContent
|
||||||
status={status}
|
status={status}
|
||||||
media={contentMedia}
|
media={contentMedia}
|
||||||
|
@ -367,6 +380,7 @@ export const DetailedStatus: React.FC<{
|
||||||
onUpdate={handleChildUpdate}
|
onUpdate={handleChildUpdate}
|
||||||
tagLinks={tagMisleadingLinks}
|
tagLinks={tagMisleadingLinks}
|
||||||
rewriteMentions={rewriteMentions}
|
rewriteMentions={rewriteMentions}
|
||||||
|
parseClick={parseClick}
|
||||||
{...(statusContentProps as any)}
|
{...(statusContentProps as any)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue