Skip to content

Commit

Permalink
fixed linkRenderer type | casting rehypeRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
ctw-joao-luis committed Nov 21, 2024
1 parent 747031e commit cc8cc27
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/suite-base/src/components/TextContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import { Link } from "@mui/material";
import { CSSProperties, PropsWithChildren, useCallback, useContext } from "react";
import Markdown from "react-markdown";
import { PluggableList } from "react-markdown/lib";
import rehypeRaw from "rehype-raw";
import { makeStyles } from "tss-react/mui";


import LinkHandlerContext from "@lichtblick/suite-base/context/LinkHandlerContext";

const useStyles = makeStyles()(({ palette, shape, spacing, typography, shadows }) => {
Expand Down Expand Up @@ -169,7 +169,7 @@ export default function TextContent(
const handleLink = useContext(LinkHandlerContext);

const linkRenderer = useCallback(
(linkProps: { href?: string; children: React.ReactNode }) => {
(linkProps: React.AnchorHTMLAttributes<HTMLAnchorElement>) => {
return (
<Link
color="primary"
Expand All @@ -181,6 +181,7 @@ export default function TextContent(
handleLink(event, linkProps.href ?? "");
}}
target="_blank"
title = {linkProps.title}

Check failure on line 184 in packages/suite-base/src/components/TextContent.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `·=·` with `=`
>
{linkProps.children}
</Link>
Expand All @@ -193,9 +194,8 @@ export default function TextContent(
<div className={classes.root} style={style}>
{typeof children === "string" ? (
<Markdown
/* eslint-disable @typescript-eslint/no-explicit-any */
rehypePlugins={allowMarkdownHtml === true ? [rehypeRaw] : ([] as any)}
components={{ a: linkRenderer } as any}
rehypePlugins={allowMarkdownHtml === true ? ([rehypeRaw] as PluggableList) : []}
components={{ a: linkRenderer }}
>
{children}
</Markdown>
Expand Down

0 comments on commit cc8cc27

Please sign in to comment.