"use client"; import { useState } from "react"; import { NodeViewWrapper, NodeViewContent } from "@tiptap/react"; import type { NodeViewProps } from "@tiptap/react"; import { Copy, Check } from "lucide-react"; function CodeBlockView({ node }: NodeViewProps) { const [copied, setCopied] = useState(false); const language = node.attrs.language || ""; const handleCopy = async () => { const text = node.textContent; if (!text) return; await navigator.clipboard.writeText(text); setCopied(true); setTimeout(() => setCopied(false), 2000); }; return (
{language && ( {language} )}
        {/* @ts-expect-error -- NodeViewContent supports as="code" at runtime */}
        
      
); } export { CodeBlockView };