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:
@@ -7,6 +7,7 @@ import {
|
||||
getKnowledgePointsByTextbookId,
|
||||
getKnowledgePointsByChapterId,
|
||||
} from "@/modules/textbooks/data-access";
|
||||
import { getKnowledgePointOptionsSchema } from "./schema";
|
||||
import type { ActionState } from "./types";
|
||||
|
||||
// 加载知识点选项(供客户端知识点选择器使用)
|
||||
@@ -18,14 +19,19 @@ export async function getKnowledgePointOptionsAction(input: {
|
||||
> {
|
||||
const t = await getTranslations("lessonPreparation");
|
||||
try {
|
||||
const parsed = getKnowledgePointOptionsSchema.safeParse(input);
|
||||
if (!parsed.success) {
|
||||
return { success: false, errors: parsed.error.flatten().fieldErrors };
|
||||
}
|
||||
|
||||
await requirePermission(Permissions.LESSON_PLAN_READ);
|
||||
if (!input.textbookId) return { success: true, data: { options: [] } };
|
||||
if (!parsed.data.textbookId) return { success: true, data: { options: [] } };
|
||||
|
||||
let kps;
|
||||
if (input.chapterId) {
|
||||
kps = await getKnowledgePointsByChapterId(input.chapterId);
|
||||
if (parsed.data.chapterId) {
|
||||
kps = await getKnowledgePointsByChapterId(parsed.data.chapterId);
|
||||
} else {
|
||||
kps = await getKnowledgePointsByTextbookId(input.textbookId);
|
||||
kps = await getKnowledgePointsByTextbookId(parsed.data.textbookId);
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user