Shun Miyazawa 1 год назад
Родитель
Сommit
ae24d03605

+ 4 - 5
apps/app/src/components/ReactMarkdownComponents/NextLink.tsx

@@ -41,12 +41,11 @@ type Props = Omit<LinkProps, 'href'> & {
   id?: string,
   href?: string,
   className?: string,
-  onClickNextLink?: () => void,
 };
 
 export const NextLink = (props: Props): JSX.Element => {
   const {
-    id, href, children, className, onClickNextLink, ...rest
+    id, href, children, className, onClick, ...rest
   } = props;
 
   const { data: siteUrl } = useSiteUrl();
@@ -62,7 +61,7 @@ export const NextLink = (props: Props): JSX.Element => {
 
   if (isExternalLink(href, siteUrl)) {
     return (
-      <a id={id} href={href} className={className} target="_blank" rel="noopener noreferrer" {...dataAttributes}>
+      <a id={id} href={href} className={className} target="_blank" onClick={onClick} rel="noopener noreferrer" {...dataAttributes}>
         {children}&nbsp;<span className="growi-custom-icons">external_link</span>
       </a>
     );
@@ -71,13 +70,13 @@ export const NextLink = (props: Props): JSX.Element => {
   // when href is an anchor link or not-creatable path
   if (isAnchorLink(href) || !isCreatablePage(href)) {
     return (
-      <a id={id} href={href} className={className} {...dataAttributes}>{children}</a>
+      <a id={id} href={href} className={className} onClick={onClick} {...dataAttributes}>{children}</a>
     );
   }
 
   return (
     <Link {...rest} href={href} prefetch={false} legacyBehavior>
-      <a href={href} className={className} {...dataAttributes} onClick={onClickNextLink}>{children}</a>
+      <a href={href} className={className} {...dataAttributes} onClick={onClick}>{children}</a>
     </Link>
   );
 };

+ 1 - 1
apps/app/src/features/openai/chat/components/AiChatModal/MessageCard.tsx

@@ -34,7 +34,7 @@ const NextLinkWrapper = (props: LinkProps & {children: string, href: string}): J
   }, [closeRagSearchModal]);
 
   return (
-    <NextLink href={props.href} onClickNextLink={onClick} className="link-primary">
+    <NextLink href={props.href} onClick={onClick} className="link-primary">
       {props.children}
     </NextLink>
   );