fix: oops
This commit is contained in:
parent
0468740f3e
commit
5c7196437b
2 changed files with 0 additions and 65 deletions
|
|
@ -1,43 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import React from "react";
|
||||
|
||||
// Type-safe wrapper that bypasses react-markdown typing issues
|
||||
interface MarkdownWrapperProps {
|
||||
children: string;
|
||||
remarkPlugins?: any[];
|
||||
rehypePlugins?: any[];
|
||||
linkTarget?: string;
|
||||
components?: any;
|
||||
}
|
||||
|
||||
const MarkdownWrapper: React.FC<MarkdownWrapperProps> = ({
|
||||
children,
|
||||
remarkPlugins,
|
||||
rehypePlugins,
|
||||
linkTarget,
|
||||
components
|
||||
}) => {
|
||||
const [MarkdownComponent, setMarkdownComponent] = React.useState<any>(null);
|
||||
|
||||
React.useEffect(() => {
|
||||
// Dynamically import react-markdown at runtime to avoid build-time type issues
|
||||
import("react-markdown").then((mod) => {
|
||||
setMarkdownComponent(() => mod.default);
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (!MarkdownComponent) {
|
||||
return <div>Loading markdown...</div>;
|
||||
}
|
||||
|
||||
return React.createElement(MarkdownComponent, {
|
||||
remarkPlugins,
|
||||
rehypePlugins,
|
||||
linkTarget,
|
||||
components,
|
||||
children,
|
||||
});
|
||||
};
|
||||
|
||||
export default MarkdownWrapper;
|
||||
22
frontend/types/jsx.d.ts
vendored
22
frontend/types/jsx.d.ts
vendored
|
|
@ -1,22 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
[elemName: string]: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'react-markdown' {
|
||||
interface ReactMarkdownProps {
|
||||
children: string;
|
||||
remarkPlugins?: any[];
|
||||
rehypePlugins?: any[];
|
||||
linkTarget?: string;
|
||||
components?: any;
|
||||
}
|
||||
|
||||
const ReactMarkdown: React.FC<ReactMarkdownProps>;
|
||||
export default ReactMarkdown;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue