diff --git a/src/components/student/lesson-content.tsx b/src/components/student/lesson-content.tsx index 82faa5e..b11dc1b 100644 --- a/src/components/student/lesson-content.tsx +++ b/src/components/student/lesson-content.tsx @@ -11,12 +11,22 @@ import Underline from "@tiptap/extension-underline"; import { Copy, Check } from "lucide-react"; import { KinescopePlayer } from "@/components/player/kinescope-player"; -function CodeBlockStudentView({ node }: { node: { textContent: string } }) { +function CodeBlockStudentView({ + node, +}: { + node: { textContent: string; attrs: Record }; +}) { const [copied, setCopied] = useState(false); const handleCopy = async () => { + const lang = (node.attrs?.language as string) || ""; + // Для блоков с языком (dataview/query/mermaid) копируем ПОЛНЫЙ markdown-забор — + // студент вставляет рабочий блок в Obsidian. Для блоков без языка — как есть. + const payload = lang + ? "```" + lang + "\n" + node.textContent + "\n```" + : node.textContent; try { - await navigator.clipboard.writeText(node.textContent); + await navigator.clipboard.writeText(payload); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch {