"use client"; import { useMemo, useState } from "react"; import { useTranslations } from "next-intl"; import { Tag, Eye, Pencil } from "lucide-react"; import type { BlackboardBlockData } from "../../types"; import { isBlackboardLayout } from "../../lib/type-guards"; import { KnowledgePointPicker } from "../knowledge-point-picker"; import { LessonPlanErrorBoundary } from "../lesson-plan-error-boundary"; interface Props { data: BlackboardBlockData; textbookId?: string; chapterId?: string; onUpdate: (data: BlackboardBlockData) => void; } const LAYOUTS: BlackboardBlockData["layout"][] = ["structure", "mindmap", "text"]; /** * V5-14 F4:板书可视化工具。 * * 在原有纯文本编辑基础上增加轻量级可视化预览(不引入新库): * - structure(结构式):按行解析缩进,渲染为带连接线的层级树 * - mindmap(思维导图):第一行为中心,其余为分支节点 * - text(文字式):等宽字体直接展示 * * 编辑/预览模式切换,避免双栏占满侧边面板。 */ export function BlackboardBlock({ data, textbookId, chapterId, onUpdate }: Props) { const t = useTranslations("lessonPreparation"); const [showKpPicker, setShowKpPicker] = useState(false); const [previewMode, setPreviewMode] = useState(false); return (
{t("blackboard.hint")}
{/* 编辑/预览切换 */}
{/* 内容区:编辑模式 or 预览模式 */} {previewMode ? ( ) : (
{/* arbitrary-value: textarea min height */}