瀏覽代碼

fix(markdown): correctly render links with inline code (#18500)

tags/1.3.0
Wunmi Sogunle 6 月之前
父節點
當前提交
ee30497237
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. 2
    2
      web/app/components/base/markdown.tsx

+ 2
- 2
web/app/components/base/markdown.tsx 查看文件

@@ -252,7 +252,7 @@ const Img = ({ src }: any) => {
return <div className="markdown-img-wrapper"><ImageGallery srcs={[src]} /></div>
}

const Link = ({ node, ...props }: any) => {
const Link = ({ node, children, ...props }: any) => {
if (node.properties?.href && node.properties.href?.toString().startsWith('abbr')) {
// eslint-disable-next-line react-hooks/rules-of-hooks
const { onSend } = useChatContext()
@@ -261,7 +261,7 @@ const Link = ({ node, ...props }: any) => {
return <abbr className="cursor-pointer underline !decoration-primary-700 decoration-dashed" onClick={() => onSend?.(hidden_text)} title={node.children[0]?.value}>{node.children[0]?.value}</abbr>
}
else {
return <a {...props} target="_blank" className="cursor-pointer underline !decoration-primary-700 decoration-dashed">{node.children[0] ? node.children[0]?.value : 'Download'}</a>
return <a {...props} target="_blank" className="cursor-pointer underline !decoration-primary-700 decoration-dashed">{children || 'Download'}</a>
}
}


Loading…
取消
儲存