feat(lesson-preparation): add anchor canvas design, new blocks, and textbook content node

- Add anchor injector for canvas-based anchor positioning

- Add new block components: blackboard, homework, import, key-point, new-teaching, objective, summary

- Add textbook content node for React Flow canvas

- Update actions (kp, publish, main), data-access (templates, versions, main)

- Update editor, node-editor, block-renderer, and picker components

- Update schema, types, hooks, and lib utilities (document-migration, node-summary, rf-mappers)
This commit is contained in:
SpecialX
2026-06-23 17:37:19 +08:00
parent 1fcef5c3aa
commit 2197e68069
34 changed files with 3190 additions and 402 deletions

View File

@@ -12,7 +12,8 @@ export const createLessonPlanSchema = z.object({
export const updateLessonPlanContentSchema = z.object({
planId: z.string().min(1),
title: z.string().min(1).max(255).optional(),
content: z.unknown(), // Block 文档结构由 types 守卫,运行时只校验存在
// Block 文档结构由 types 守卫,运行时只校验是对象
content: z.record(z.string(), z.unknown()),
});
export const saveVersionSchema = z.object({
@@ -30,5 +31,32 @@ export const saveAsTemplateSchema = z.object({
name: z.string().min(1).max(100),
});
// AI 知识点推荐输入校验
export const suggestKnowledgePointsSchema = z.object({
doc: z.record(z.string(), z.unknown()),
textbookId: z.string().optional(),
chapterId: z.string().optional(),
});
// 知识点选项查询输入校验
export const getKnowledgePointOptionsSchema = z.object({
textbookId: z.string().optional(),
chapterId: z.string().optional(),
});
// 发布作业输入校验
const dateStringSchema = z
.string()
.refine((v) => !Number.isNaN(new Date(v).getTime()), "Invalid date format");
export const publishLessonPlanHomeworkSchema = z.object({
planId: z.string().min(1),
blockId: z.string().min(1),
classIds: z.array(z.string().min(1)).min(1, "至少选择一个班级"),
availableAt: dateStringSchema.optional(),
dueAt: dateStringSchema.optional(),
});
export type CreateLessonPlanInput = z.infer<typeof createLessonPlanSchema>;
export type UpdateLessonPlanContentInput = z.infer<typeof updateLessonPlanContentSchema>;
export type PublishLessonPlanHomeworkInput = z.infer<typeof publishLessonPlanHomeworkSchema>;