Merge pull request #47 from langflow-ai/cz/fix-package-versions
feat: Enhance markdown rendering and dropdown consistency
This commit is contained in:
commit
ce7901ec9e
4 changed files with 1042 additions and 1228 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { EllipsisVertical } from "lucide-react";
|
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
|
import { EllipsisVertical } from "lucide-react";
|
||||||
import { Button } from "./ui/button";
|
import { Button } from "./ui/button";
|
||||||
|
|
||||||
export function KnowledgeActionsDropdown() {
|
export function KnowledgeActionsDropdown() {
|
||||||
|
|
@ -18,7 +18,9 @@ export function KnowledgeActionsDropdown() {
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent side="right" sideOffset={-10}>
|
<DropdownMenuContent side="right" sideOffset={-10}>
|
||||||
<DropdownMenuItem variant="destructive">Delete</DropdownMenuItem>
|
<DropdownMenuItem className="text-destructive focus:text-destructive-foreground focus:bg-destructive">
|
||||||
|
Delete
|
||||||
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ export const MarkdownRenderer = ({ chatMessage }: MarkdownRendererProps) => {
|
||||||
<Markdown
|
<Markdown
|
||||||
remarkPlugins={[remarkGfm]}
|
remarkPlugins={[remarkGfm]}
|
||||||
rehypePlugins={[rehypeMathjax, rehypeRaw]}
|
rehypePlugins={[rehypeMathjax, rehypeRaw]}
|
||||||
linkTarget="_blank"
|
urlTransform={(url) => url}
|
||||||
components={{
|
components={{
|
||||||
p({ node, ...props }) {
|
p({ node, ...props }) {
|
||||||
return <p className="w-fit max-w-full">{props.children}</p>;
|
return <p className="w-fit max-w-full">{props.children}</p>;
|
||||||
|
|
@ -79,7 +79,7 @@ export const MarkdownRenderer = ({ chatMessage }: MarkdownRendererProps) => {
|
||||||
h3({ node, ...props }) {
|
h3({ node, ...props }) {
|
||||||
return <h3 className="mb-2 mt-4">{props.children}</h3>;
|
return <h3 className="mb-2 mt-4">{props.children}</h3>;
|
||||||
},
|
},
|
||||||
hr({ node, ...props }) {
|
hr() {
|
||||||
return <hr className="w-full mt-4 mb-8" />;
|
return <hr className="w-full mt-4 mb-8" />;
|
||||||
},
|
},
|
||||||
ul({ node, ...props }) {
|
ul({ node, ...props }) {
|
||||||
|
|
@ -97,8 +97,12 @@ export const MarkdownRenderer = ({ chatMessage }: MarkdownRendererProps) => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
a({ node, ...props }) {
|
||||||
|
return <a {...props} target="_blank" rel="noopener noreferrer">{props.children}</a>;
|
||||||
|
},
|
||||||
|
|
||||||
code: ({ node, className, inline, children, ...props }) => {
|
code(props) {
|
||||||
|
const { children, className, ...rest } = props;
|
||||||
let content = children as string;
|
let content = children as string;
|
||||||
if (
|
if (
|
||||||
Array.isArray(children) &&
|
Array.isArray(children) &&
|
||||||
|
|
@ -120,14 +124,15 @@ export const MarkdownRenderer = ({ chatMessage }: MarkdownRendererProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const match = /language-(\w+)/.exec(className || "");
|
const match = /language-(\w+)/.exec(className || "");
|
||||||
|
const isInline = !className?.startsWith("language-");
|
||||||
|
|
||||||
return !inline ? (
|
return !isInline ? (
|
||||||
<CodeComponent
|
<CodeComponent
|
||||||
language={(match && match[1]) || ""}
|
language={(match && match[1]) || ""}
|
||||||
code={String(content).replace(/\n$/, "")}
|
code={String(content).replace(/\n$/, "")}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<code className={className} {...props}>
|
<code className={className} {...rest}>
|
||||||
{content}
|
{content}
|
||||||
</code>
|
</code>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
2240
frontend/package-lock.json
generated
2240
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -38,11 +38,11 @@
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-icons": "^5.5.0",
|
"react-icons": "^5.5.0",
|
||||||
"react-markdown": "^8.0.7",
|
"react-markdown": "^10.1.0",
|
||||||
"react-syntax-highlighter": "^15.6.1",
|
"react-syntax-highlighter": "^15.6.1",
|
||||||
"rehype-mathjax": "^4.0.3",
|
"rehype-mathjax": "^7.1.0",
|
||||||
"rehype-raw": "^6.1.1",
|
"rehype-raw": "^7.0.0",
|
||||||
"remark-gfm": "3.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"sonner": "^2.0.6",
|
"sonner": "^2.0.6",
|
||||||
"tailwind-merge": "^3.3.1",
|
"tailwind-merge": "^3.3.1",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
|
"@types/react-syntax-highlighter": "^15.5.13",
|
||||||
"autoprefixer": "^10.4.21",
|
"autoprefixer": "^10.4.21",
|
||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "15.3.5",
|
"eslint-config-next": "15.3.5",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue