mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-12 13:03:43 +08:00
Update markdown.tsx
add _self target for settings
This commit is contained in:
@@ -96,7 +96,17 @@ export function Markdown(
|
|||||||
components={{
|
components={{
|
||||||
pre: PreCode,
|
pre: PreCode,
|
||||||
}}
|
}}
|
||||||
linkTarget={"_blank"}
|
renderers={{
|
||||||
|
link: (props) => {
|
||||||
|
// 判断链接是否为内部地址
|
||||||
|
const isInternal = /^\/(?!\/)/.test(props.href);
|
||||||
|
|
||||||
|
// 如果是内部地址,使用_self,否则使用_blank
|
||||||
|
const target = isInternal ? "_self" : "_blank";
|
||||||
|
|
||||||
|
return <a {...props} target={target} />;
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{props.content}
|
{props.content}
|
||||||
</ReactMarkdown>
|
</ReactMarkdown>
|
||||||
|
Reference in New Issue
Block a user