fix(Markdown/Link): set href to undefined when it's empty (#9343)

fix(Markdown/Link): 处理空链接时设置href为undefined
This commit is contained in:
Phantom
2025-08-21 11:02:41 +08:00
committed by GitHub
parent 174b9bdc3d
commit 1af4a2686b
@@ -1,4 +1,4 @@
import { omit } from 'lodash'
import { isEmpty, omit } from 'lodash'
import React from 'react'
import type { Node } from 'unist'
@@ -33,6 +33,7 @@ const Link: React.FC<LinkProps> = (props) => {
<CitationTooltip citation={props.citationData}>
<a
{...omit(props, ['node', 'citationData'])}
href={isEmpty(props.href) ? undefined : props.href}
target="_blank"
rel="noreferrer"
onClick={(e) => e.stopPropagation()}