mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-08 04:05:54 -05:00
markdown open links to new window
This commit is contained in:
@@ -76,7 +76,7 @@ const Markdown: React.FC<MarkdownProps> = ({
|
||||
link: (props: any) => {
|
||||
const { children } = props;
|
||||
return (
|
||||
<MyLink isExternal {...props}>
|
||||
<MyLink isExternal {...props} toNewWindow>
|
||||
{children}
|
||||
</MyLink>
|
||||
);
|
||||
|
||||
@@ -8,6 +8,7 @@ interface Props {
|
||||
isExternal?: boolean;
|
||||
prefetch?: boolean;
|
||||
isColored?: boolean;
|
||||
toNewWindow?: boolean;
|
||||
}
|
||||
|
||||
const MyLink: React.FC<Props> = ({
|
||||
@@ -16,12 +17,17 @@ const MyLink: React.FC<Props> = ({
|
||||
isExternal,
|
||||
prefetch = false,
|
||||
isColored = true,
|
||||
toNewWindow,
|
||||
}) => {
|
||||
const { themeColorShade } = useMyTheme();
|
||||
|
||||
if (isExternal) {
|
||||
return (
|
||||
<ChakraLink href={href} color={isColored ? themeColorShade : undefined}>
|
||||
<ChakraLink
|
||||
href={href}
|
||||
color={isColored ? themeColorShade : undefined}
|
||||
target={toNewWindow ? "_blank" : undefined}
|
||||
>
|
||||
{children}
|
||||
</ChakraLink>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user