diff --git a/packages/api-explorer/src/components/DocMarkdown/DocMarkdown.tsx b/packages/api-explorer/src/components/DocMarkdown/DocMarkdown.tsx index f00456560..b8bc553e0 100644 --- a/packages/api-explorer/src/components/DocMarkdown/DocMarkdown.tsx +++ b/packages/api-explorer/src/components/DocMarkdown/DocMarkdown.tsx @@ -47,6 +47,8 @@ export const DocMarkdown: FC = ({ source, specKey }) => { const linkClickHandler = (pathname: string, url: string) => { if (pathname.startsWith(`/${specKey}`)) { history.push(pathname) + } else if (url.startsWith(`/${specKey}`)) { + history.push(url) } else if (url.startsWith('https://')) { envAdaptor.openBrowserWindow(url) } diff --git a/packages/code-editor/src/Markdown/Markdown.tsx b/packages/code-editor/src/Markdown/Markdown.tsx index 75cdf77ce..380b01c34 100644 --- a/packages/code-editor/src/Markdown/Markdown.tsx +++ b/packages/code-editor/src/Markdown/Markdown.tsx @@ -68,7 +68,10 @@ export const Markdown: FC = ({ // Could be a tag wrapped by an anchor const a = findAnchor(e.target) if (a) { - linkClickHandler(a.pathname, a.href) + linkClickHandler( + a.getAttribute('pathname') || '', + a.getAttribute('href') || '' + ) } } }