mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +01:00
fix extern links md
This commit is contained in:
parent
cab701d3ea
commit
1591a0ca26
@ -14,12 +14,16 @@ import rehypeRaw from "rehype-raw";
|
|||||||
import rehypeSlug from "rehype-slug";
|
import rehypeSlug from "rehype-slug";
|
||||||
import RemarkFlexibleToc, { TocItem } from "remark-flexible-toc";
|
import RemarkFlexibleToc, { TocItem } from "remark-flexible-toc";
|
||||||
import remarkGfm from "remark-gfm";
|
import remarkGfm from "remark-gfm";
|
||||||
|
import { openLink } from "../store/global";
|
||||||
import "./markdown.less";
|
import "./markdown.less";
|
||||||
|
|
||||||
const Link = ({ href, children }: { href: string; children: React.ReactNode }) => {
|
const Link = ({ href, children }: { href: string; children: React.ReactNode }) => {
|
||||||
const newUrl = "https://extern?" + encodeURIComponent(href);
|
const onClick = (e: React.MouseEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
openLink(href);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<a href={newUrl} target="_blank" rel="noopener">
|
<a href={href} onClick={onClick}>
|
||||||
{children}
|
{children}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user