import React, { memo } from "react" import { SquareArrowOutUpRight } from "lucide-react" import { vscode } from "@src/utils/vscode" import { hasComplexMarkdown } from "@src/utils/markdown" import { StandardTooltip } from "@src/components/ui" interface OpenMarkdownPreviewButtonProps { markdown: string | undefined className?: string } export const OpenMarkdownPreviewButton = memo(({ markdown, className }: OpenMarkdownPreviewButtonProps) => { if (!hasComplexMarkdown(markdown)) { return null } const handleClick = (e: React.MouseEvent) => { e.stopPropagation() if (markdown) { vscode.postMessage({ type: "openMarkdownPreview", text: markdown, }) } } return ( ) })