abbr.tsx
704 Bytes
import { FC } from 'react'
import { InputMessageType } from '../../../chat/types'
import { useChatContext } from '@/app/components/base/chat/chat-with-history/context/chat-context'
import type { LinkProps } from './index'
const AbbrLink: FC<LinkProps> = ({ node }) => {
const hidden_text = decodeURIComponent(node?.properties?.href?.toString().split('abbr:')[1])
const { onSend } = useChatContext()
return (
<abbr
className="cursor-pointer underline !decoration-primary-700 decoration-dashed"
onClick={() => onSend?.(hidden_text, InputMessageType.BY_HAND)}
title={node.children[0]?.value || ''}>
{node.children[0]?.value || ''}
</abbr>
)
}
export default AbbrLink