'use client'; import React from 'react'; import { cn, withRef } from '@udecode/cn'; import { NodeApi } from '@udecode/plate'; import { formatCodeBlock, isLangSupported } from '@udecode/plate-code-block'; import { PlateElement } from '@udecode/plate/react'; import { BracesIcon, CheckIcon, CopyIcon } from 'lucide-react'; import { Button } from './button'; import { CodeBlockCombobox } from './code-block-combobox'; export const CodeBlockElement = withRef( ({ children, className, ...props }, ref) => { const { editor, element } = props; return (
            {children}
          
{isLangSupported(element.lang as string) && ( )} NodeApi.string(element)} />
); }, ); function CopyButton({ showLabel = false, value, ...props }: { value: (() => string) | string; showLabel?: boolean } & Omit< React.ComponentProps, 'value' >) { const [hasCopied, setHasCopied] = React.useState(false); React.useEffect(() => { setTimeout(() => { setHasCopied(false); }, 2000); }, [hasCopied]); return ( ); }